Previously I wrote a Post: Tip: Specifies the default file name in the dialog box when the browser downloads and saves dynamically generated data. However, if the specified file name contains spaces, fireFox uses the part before the space as the default file name.
The solution is simple: Enclose the file name with double quotation marks: Response. AppendHeader ("Content-Disposition", "attachment; filename = \" "+ fileName + "\"");
Response. ContentType = "application/octet-stream ";
However, the problem persists. in IE, if the file name contains two English names (period, character '. '), it will automatically add "[1]" before the first point, so your original file name is "aaa. bbb. whatever "becomes" aaa [1]. bbb. whatever ". who knows how to solve this problem?
--------
Update: According to Microsoft, the second problem cannot be solved.
I said, let's persuade users to discard IE!
--------
Update:
The second problem can be solved as follows: If (Request. Browser. Browser. Contains ("IE "))
{
String ext = fileName. Substring (fileName. LastIndexOf ('.'));
String name = fileName. Remove (fileName. Length-ext. Length );
Name = name. Replace (".", "% 2e ");
FileName = name + ext;
}
Response. AppendHeader ("Content-Disposition", "attachment; filename = \" "+ fileName + "\"");
Response. ContentType = "application/octet-stream ";