Click here to Skip to main content
15,906,335 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
when click on link of download button for pdf file it will open on browser but i want to download it not on open on browser , i can not want open it on browser....

so plz give solution of this in asp.net


thank you in advance


Mohit Agarwal
Posted
Updated 3-Jun-11 17:09pm
v2

string filename = "filename from Database";
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + filename);
string aaa = Server.MapPath("~/SavedFolder/" + filename);
Response.TransmitFile(Server.MapPath("~/SavedFolder/" + filename));
Response.End();


or
have a look on this link,-
File Upload and Download in ASP.NET[^]
 
Share this answer
 
 
Share this answer
 
Comments
Espen Harlinn 5-Jun-11 6:04am    
Nice links, my 5
C#
//download 
 Response.Redirect("~/UploadFolder/test.doc");
//upload
        string savePath= Server.MapPath("path");
        FileUpload1.SaveAs(savePath);
 
Share this answer
 
[^]


This article will help you
 
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