读书人

C# MVC 火狐上载文件时弹窗中的文件

发布时间: 2012-09-11 10:49:03 作者: rapoo

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
进行更多的控制

读书人网 >C#

热点推荐