Reputation: 5044
on my site, i need to display a link, clicking on which should prompt user with Save As dialog so that they can save the file, on there machine instead of seeing the file in browser.
Please any one knows the html code for downloading the Text and HTML file. .txt and .html
Upvotes: 0
Views: 446
Reputation: 19220
You just need to link to the file to be downloaded the rest is handled by the client.
If you are dynamically generating the file in ASP.NET you need to set some additional headers to force a download.
Content-Disposition: attachment; filename=<filename.ext>
In code:
Response.AddHeader("content-disposition:","attachment;filename=<filename.ext>");
Upvotes: 1
Reputation: 943510
A link is a link. It can't influence how the browser will handle the content (and nor can anything else in the document)
If you want the browser to download something it would normally render (either natively or with a plugin) then you need to set a Content-Disposition header on the HTTP response.
See this example of how to do it with Apache for PDF files and adapt as per your own requirements.
Upvotes: 0