Downloading file with ";" or "#" in file name ruins filename
        Posted  
        
            by Sergej Andrejev
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Sergej Andrejev
        
        
        
        Published on 2009-03-29T20:52:07Z
        Indexed on 
            2010/04/21
            14:13 UTC
        
        
        Read the original article
        Hit count: 285
        
ASP.NET
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();
        © Stack Overflow or respective owner