The solution to the garbled file name when downloading a file with a Chinese name

  1. Use the System.Web.HttpUtility.UrlEncode or Server.UrlEncode method, but write both parameters:
    System.Web.HttpUtility.UrlEncode("报表",System.Text.Encoding.UTF8)
    
  2. With the HttpUtility.UrlPathEncode method, just write one parameter:
    HttpUtility.UrlPathEncode("报表.xls")
      

Method 2 was used in " asp.net download large file code "

Reprinted in: https://www.cnblogs.com/ruanzb/archive/2010/06/30/1768281.html

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=324098937&siteId=291194637