Downloading files - prompt shown twice

  • Thread starter Thread starter Marina
  • Start date Start date
M

Marina

Hi, I have the following code to prompt the user for a download:
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment;filename=test.pdf")
Response.WriteFile("C:\test.pdf")
Response.End()

This works well, as far as prompting the user for download.

However, if I chose "Open", I then get the same prompt again. If I chose 'Open' the second time,then the file actually gets downloaded and opened.

This double prompt issue does not happen if i chose Save. This works as expected.

Anyone know what's going on?
 
Is this code in the same page as the link to download the file?

When the download link/button is clicked try opening a new window with the code below in it.

--
S. Justin Gengo, MCP
Web Developer / Programmer

Free Code Library At:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche


Hi, I have the following code to prompt the user for a download:
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AppendHeader("Content-Disposition", "attachment;filename=test.pdf")
Response.WriteFile("C:\test.pdf")
Response.End()

This works well, as far as prompting the user for download.

However, if I chose "Open", I then get the same prompt again. If I chose 'Open' the second time,then the file actually gets downloaded and opened.

This double prompt issue does not happen if i chose Save. This works as expected.

Anyone know what's going on?
 
Back
Top