Different browsers need special settings, mainly Firefox is more special, Firefox may give the file name "%0d%0a" such as encoding characters (the meaning of the line). Have to admire the online master, this can also solve.
1 [HttpGet]2 PublicFileresult Download (stringID)3 {4 varDocument =service. GetDocument (ID);5 varFullName =Path.Combine (Root, document. FullName);6 stringBrowser =HttpContext.Request.UserAgent.ToUpper ();7 varFileName =document. Name;8 if(Browser. Contains ("FIREFOX"))9 fileName = "=?" UTF-8? B? "+ convert.tobase64string (Encoding.UTF8.GetBytes (fileName)) +"? = ";Ten Else OneFileName =Httputility.urlencode (FileName, Encoding.UTF8); A returnFile (FullName, document. ContentType, fileName); -}
For the processing of Firefox (red code), I was drunk, did not read, but the problem solved!
"References" http://www.cnblogs.com/godtrue/p/4333262.html
How to set the file name of Firefox download correctly