Click here to Skip to main content
15,909,039 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How can I code a file on Visual Studio 2008 that when you click on its link, a download dialog box pops up and you can actually save it on your local drive.
Posted

Go through the below link..,

File Download in ASP.NET and Tracking the Status of Success/Failure of Download[^]

There are so many examples available on Net , a simple google search solve you problem.

see this ...

Google[^]
 
Share this answer
 
These may help you

Download pdf,word,text file in asp.net[^]

File download in asp.net[^]

How to Download a file with a path in asp.net[^]

There are so many examples available on Net , a simple google search solve you problem.
 
Share this answer
 
v2
C#
string strFilePath = "./downloads/filename.txt";
               Response.AppendHeader("Content-Disposition", "attachment; filename=" + strFilePath);
               Response.WriteFile(strFilePath);
               Response.End();
 
Share this answer
 
Normally source files are shielded so they cannot be downloaded by the client. This is of course a safety to protect your source files. To overcome this you must handle it yourself explicitly so it is also clear that you meant for it to be downloaded. Be sure to think about the security risks and never allow the client to specify the actual filename because then extra malicious information could be added. Such as "..\..\file.cs". Some kind of key that corresponds to the file is much more safe.

Simple example of a download handler:
http://aspnetupload.com/Quickstart/Download-From-File.aspx[^]

Good luck!
 
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