Click here to Skip to main content
15,909,091 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all i have created web application and i hosted into server, in my application i ll create some text file when certain event occurs, i want to download that text file when user click the button. how to do this
Posted

C#
string strFilePath = "";//Here give your filepath
                Response.AppendHeader("Content-Disposition", "attachment; filename=" + strFilePath);
                Response.WriteFile(strFilePath);
                Response.End();
 
Share this answer
 
v2
Please See this..

Download File Using Hyperlink[^]
 
Share this answer
 

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



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