November 4, 2008

File Downloading (.pdf)in asp.net

//Set the appropriate ContentType.
Response.ContentType = "Application/pdf";
//Get the physical path to the file.
string FilePath = AppDomain.CurrentDomain.BaseDirectory + "images\\file.pdf";
//Write the file directly to the HTTP content output stream.
Response.WriteFile(FilePath);
Response.End();


you can download any type of file just change the Content type

No comments: