Try { stringExcelname = request["Excelname"]. ToString ();//file path stringFileName = request["FileName"]. ToString ();//Download the file name if(! (string. IsNullOrEmpty (excelname) | |string. IsNullOrEmpty (FileName)) {Response.Charset="GB2312"; Response.ContentEncoding= Encoding.GetEncoding ("GB2312"); Response.ContentType="Application/vnd.ms-excel"; Firefox does not need to convert the Chinese file name to the IF (request.servervariables["Http_user_agent") in the encoding format. ToLower (). IndexOf ("Firefox") = =-1) {excelname = Httputility.urlencode (Excelname, System.Text.Encoding.UTF8);}Response.appendheader ("content-disposition","attachment;filename="+excelname); Response.WriteFile (FileName); Response.Flush (); Response.close (); } } Catch { }
Note that browser IE needs to convert the Chinese file name encoding format, and the Firefox browser does not, or download the Chinese file name will be garbled
Download files from the server Chinese name garbled solution