Under firefox/ie response Chinese file name garbled problem solution font: [Increase decrease] type: Reprint
Only for the case of no space and IE use Response.appendheader () if you want to output a file without encoding in Firefox, and IE, the output of the file name Hollow lattice is not a + number, it is more than once judged, next will be detailed introduction of interested friends can understand the next That might help you. And found a lot of people in the garden handling response. Download the file name using this method
Response.appendheader ("Content-disposition", "attachment;filename=" + httputility.urlencode (FileInfo.Name, SYSTEM.TEXT.ENCODING.UTF8));
But this is only for the absence of spaces and IE in the case of use.
If you want to output a file that is not encoded in Firefox, and the file name of IE output is not a + number, it will be judged more than once.
Copy CodeThe code is as follows:
if (HttpContext.Current.Request. Useragent.tolower (). IndexOf ("MSIE") >-1)
{
DownloadFileName = Httputility.urlpathencode (downloadfilename);
}
if (HttpContext.Current.Request. Useragent.tolower (). IndexOf ("Firefox") >-1)
{
Response.AddHeader ("Content-disposition", "attachment;filename=\" "+ downloadfilename +" \ ");
}
Else
{
Response.AddHeader ("Content-disposition", "attachment;filename=" + downloadfilename);
}
Enables the server to gather information about the browser functionality that is running on the client. The following code is common code, and other specific information is provided in MSDN.
HttpBrowserCapabilities B = request.browser;
Response.Write ("Browser name and version number:" + B.type + "<br>");
Response.Write ("Name:" + b.browser + "<br>");
Response.Write ("version:" + b.version + "<br>");
Response.Write ("Operating platform:" + b.platform + "<br>");
Response.Write ("Support frame:" + b.frames + "<br>");
Response.Write ("Support table:" + b.tables + "<br>");
Response.Write ("Whether Cookies are supported:" + b.cookies + "<br>");
Browser name and version number: IE6
Name: IE
Version: 6.0
Operating platform: WinXP
Whether frame is supported: True
Whether table is supported: True
Whether to support Cookies:true
Response Chinese file name garbled problem under firefox/ie solution