Downloading file with “;” or “#” in file name ruins filename

前端 未结 4 1726
没有蜡笔的小新
没有蜡笔的小新 2020-12-01 20:20

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 includ

4条回答
  •  -上瘾入骨i
    2020-12-01 21:17

    Filename with special symbols(e.g: space; # @ ! $ ) or Non-Unicode characters either cannot be supported by some browsers or cause incorrect filename in client machine. Here is an article by a Chinese called chanext, he gave a perfect way to solve this problem: this article gave a sample code(written with c#) to show how to get perfect solution to this problem in the all four popular browsers (IE; Opera; Firefox and Chrome) the filename "Microsoft.Asp.Net.doc" and "F ile;;!@%#^&y.doc" can both be output correctly using the way the author provided in this article.

    http://ciznx.com/post/aspnetstreamdownloaddisplaynonunicodespacechar.aspx

提交回复
热议问题