Downloading file with ";" or "#" in file name ruins filename
- by Sergej Andrejev
I have a file named AttachmentDownload.aspx and inside Page_Load method have such code wich offers to download file. All names work correctly in IE except names which include ";" or "#". They offer user to save the file under name "AttachmentDownload.aspx". Is there a workaround for this?
Here is an example:
var fileName = Server.UrlPathEncode (";%.txt");
Response.AddHeader("content-disposition", String.Format("attachment;filename=\"{0}\"", fileName));
Response.WriteFile(path);
Response.End();