Response.ClearContent();
Response.ClearHeaders(); Response.ContentType="application/octet-stream"; Response.AppendHeader("Content-disposition","attachment; filename=中文.rar"); Response.BinaryWrite(obj); //obj为二进制流 Response.Flush();
Response.End();
帮帮忙呢。有点急,使用此方法进行文件下载时,提示保存文件时,文件名 "中文.rar" 会变成乱码
如果将 "中文.rar"变成英文则不会。请问这应该怎么样操作。
Response.ClearHeaders(); Response.ContentType="application/octet-stream"; Response.AppendHeader("Content-disposition","attachment; filename=中文.rar"); Response.BinaryWrite(obj); //obj为二进制流 Response.Flush();
Response.End();
帮帮忙呢。有点急,使用此方法进行文件下载时,提示保存文件时,文件名 "中文.rar" 会变成乱码
如果将 "中文.rar"变成英文则不会。请问这应该怎么样操作。
修改
<globalization
requestEncoding="gb2312"
responseEncoding="gb2312"
/>
试试:)
文件名(N) 输入框会乱码,是怎么回事?
如 文件: 通讯录.xls 会变成 ㄊ狈⑺褪蔽募.xls
怎么解决这个问题? 这是download.aspx page_load 事件中的代码: Dim Flag As String
Dim Path As String Flag = Request("Flag")
If Flag = "MailFiles" Then
Path = "D:\MailFiles\" & Request("File")
Else
Path = "D:\ATT\" & Request("File")
End If
Dim File As New System.IO.FileInfo(Path)
Response.Clear()
Response.AddHeader("Content-Disposition", "attachment; filename=" + File.Name)
Response.AddHeader("Content-Length", File.Length.ToString())
Response.ContentType = "application/octet-stream"
Response.WriteFile(File.FullName)
Response.End()
--------------------------------------------------------------- try Response.AddHeader("Content-Disposition", "attachment; filename=" + HttpUtility.UrlEncode(File.Name))