我有一个名为AttachmentDownload.aspx的文件,里面的Page_Load方法有这样的代码提供下载文件.所有名称在IE中都能正常工作,但名称中包含";" 要么 "#".它们为用户提供了名为"AttachmentDownload.aspx"的文件保存.这有解决方法吗?
这是一个例子:
var fileName = Server.UrlPathEncode (";%.txt");
Response.AddHeader("content-disposition", String.Format("attachment;filename=\"{0}\"", fileName));
Response.WriteFile(path);
Response.End();
Run Code Online (Sandbox Code Playgroud) asp.net ×1