Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
C#
string filePath = (sender as LinkButton).CommandArgument;
Response.AppendHeader ("Content-Type", "Application/octet-stream");
Response.AppendHeader("Content-Disposition", "attachment; filename=" + Path.GetFileName(filePath)  );
Response.WriteFile(filePath);
Response.End();
Posted
Comments
George Jonsson 19-Nov-14 13:05pm    
So what is the value of the variable 'filePath'?
And paths usually look like 'D:\Directory1\Directory2\filename.ext' in Windows.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900