How can I make a download page?

How do I make a download page in ASP.NET?

  • I am trying to put a link on the page but when I click on the link, the browser tries to open the file instead of displaying the download dialog box. Any ideas on how to fix this issue? Thanks

  • Answer:

    Actually, this is a function of Internet Explorer / Modzilla / Firefox / Opera and not asp or .net at all. There is no way to force a file to download (for security reasons). But, you can have a screen pop up to say open or save. But then it would be up to the user to choose the correct option, and save it in a location other than the default temporary folder which I have had problems letting them choose or just opening the file. Under the internet zone security settings you can set the download options under the advanced settings. I had to roll out a policy change for ie7 for this very reason.

Mike P at Yahoo! Answers Visit the source

Was this solution helpful to you?

Other answers

The proper form for a link is <a href="the link to the file">the text to click</a> If it doesn't work it's because the server thinks it's a file to display or run. Text files, for instance, will just display. HTML files will be sent to the browser as normal web page content. Just Response.Write('<a href='" + yourVariableWithTheLink + "'>" + yourVariableWithTheTextToClickOn + "</a>")

Colanth

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.