1

我想从 ASP.net 保存/打开一个文件。

if (Request.Browser.Browser == "IE" && (Request.Browser.Version == "7.0" || Request.Browser.Version == "8.0" || Request.Browser.Version == "9.0"))
contentDisposition = "inline; filename=" + Uri.EscapeDataString(fileName);
else
contentDisposition = "inline; filename*=UTF-8''" + Uri.EscapeDataString(fileName);

Response.ContentEncoding = System.Text.Encoding.UTF8;
Response.Charset = "UTF-8";
Response.ContentType = "application/" + mimeType;
Response.AppendHeader("content-disposition", contentDisposition + "." + extension);

使用此示例 áéáá asd.pdf,我得到以下 áéáá%20asd.pdf。我想要一个简单的空间,而不是 %20。

4

1 回答 1

0

使用字符串的替换方法,这里是例子: string result = filename.Replace("%20"," ")方法

于 2012-09-07T09:05:10.870 回答