Click here to Skip to main content
15,897,518 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
this code is use to download the file from local system


C#
protected void LinkButtonDownload_Click(object sender, EventArgs e)
   {
       Response.ContentType = "Application/msword";
       Response.AppendHeader("Content-Disposition", "attachment; filename=Test.docx");
       Response.TransmitFile(Server.MapPath("~/Files/Test.docx"));
       Response.End();
   }



but i need the code to download the file from sql database.........
pls hlp me........
Posted
Updated 8-Feb-12 23:30pm
v3

1 solution

Well, it looks like you're downloading TO the local file system. If your file is inside a DB, you need to pull it out and use Response.BinaryWrite instead of Response.TransmitFile to write it to the stream.
 
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