首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

C# MVC 火狐上载文件时,弹窗中的文件名为乱码

2012-09-11 
C# MVC 火狐下载文件时,弹窗中的文件名为乱码C# MVC 火狐下载文件时,弹窗中的文件名为乱码,但是IE不乱码。

C# MVC 火狐下载文件时,弹窗中的文件名为乱码
C# MVC 火狐下载文件时,弹窗中的文件名为乱码,但是IE不乱码。
代码如下:

C# code
public ActionResult DownloadFile(Guid id)        {            try            {                Document document = DocumentDao.GetDocumentById(id);                string path = string.Format("{0}/{1}", Server.MapPath("/Documents"), document.ArchiveIdentity);                return File(path, "application/octet-stream", Url.Content(document.FileName));            }            catch {                return null;            }        }



[解决办法]
火狐不需要编码,你要区别对待
通过Request\.UserAgent区别不同的浏览器
[解决办法]
你可以参考
http://stackoverflow.com/questions/5826649/returning-a-file-to-view-download-in-mvc
进行更多的控制

热点排行