Click here to Skip to main content
15,949,741 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have a hyperlink on click of which i need to download some file using Save As Dialog box. How can this be implemented?
Posted

1 solution

Hi,

try this you can show saveas dialog box

C#
Response.ContentType = "image/jpeg";
Response.AppendHeader("Content-Disposition","attachment; filename=SailBig.jpg");
Response.TransmitFile( Server.MapPath("~/images/sailbig.jpg") );
Response.End();


Here you can change contentType as your requirement.

All the Best
 
Share this answer
 
Comments
Member 8191831 6-Oct-11 0:54am    
Can you please be more specific as to where to write this code on click of hyperlink?
Muralikrishna8811 6-Oct-11 0:59am    
sure

place linkbutton instead of hyperlink

otherwise
directly write as code

<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ="Downloads/hosting.rar">HyperLink
browser can show bydefault for rar or zip files when you write like this



and write this code in linkbutton click event.

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