How to set the file name of Firefox download correctly

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.