Home > DeveloperSection > Forums > Downloading a file found in my solution folder
Royce Roy
Royce Roy

Total Post:149

Posted on    October-05-2013 2:26 AM

 ASP.Net ASP.Net 

 1 Reply(s)
 901  View(s)
Rate this:

Guys I am making an application that plays a media file from a folder of my solution. I have to allow the user to download the very file that is playing. Any help?

I am on VS2010 (c#)

Dag Hammarskjold
Dag Hammarskjold

Total Post:24

Posted on    October-05-2013 4:13 AM

Take a look at this short sample code:

Response.ContentType = "application/pdf";
Response.AppendHeader("Content-Disposition", "attachment; filename=MyFile.pdf");

You can get to the file in your solution with the Server.MapPath method.

Don't want to miss updates? Please click the below button!

Follow MindStick