If you have an ASP file that dynamically produces files in binary for download, you've probably noticed that when the client saves the file, it gets renamed to yourfile.asp instead of thefile.ext. Here's how you can avoid this... before sending the response.binarywrite command, issue this:
<% fn = "thisfile.ext" Response.AddHeader "Content-Disposition","attachment;filename=" & fn ... response.binarywrite(binarydata) %> |
Note that some 3rd-party download managers will still override this setting, and save the file as yourfile.asp. You can try the utlities mentioned in
Article #2232 to see if any suit your needs.
Some versions of Internet Explorer will not like the above format. There are at least six versions of the command that you might have to try, and they are largely mutually exclusive, so you will likely have to send conditional code based on the browser version.
Response.AddHeader "Content-Disposition", "attachment; filename=" & fn Response.AddHeader "Content-Disposition", "attachment; filename=" & fn & ";" Response.AddHeader "Content-Disposition", "inline; filename=" & fn Response.AddHeader "Content-Disposition", "inline; filename=" & fn & ";" Response.AddHeader "Content-Disposition", "filename=" & fn Response.AddHeader "Content-Disposition", "filename=" & fn & ";" |
See
Article #2161 for more information and sample code for sending files to the client.