chris 0

chris 0

  • NA
  • 6
  • 0

Create downloadable file dynamically

Apr 12 2006 2:14 PM

Hi all.

I am trying to create a link on a page that dynamically creates a file and presents it for download.

I was hoping to create an aspx file that could be called (for example) like this:

<a href='getfile.aspx?id=1'>Click me</a> where getfile.aspx creates the file. I could create the file, save it on the server, and then offer a link to it, but I'd rather the result of clicking on the link be the 'Save file as...' dialog box.

I've searched and can't find out the answer!

How would I code a simple page to return a text file, just containing "Hello world" that internet explorer would want to save as a text file when the link is clicked? The best I've achieved is a save file that contains my data along with the html for the page, which I don't want.

Any help greatfully received, any more information required, please ask!

Chris