Dim root As String = "d:\temp\" Dim filepath As String = Request.Params("file") filepath=System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(filepath)); If Not filepath Is Nothing Then If File.Exists(filepath) And filepath.StartsWith(root) Then Dim filename As String = Path.GetFileName(filepath) Response.Clear() Response.ContentType = "application/octet-stream" Response.AddHeader("Content-Disposition", _ "attachment; filename=""" & filename & """") Response.Flush() Response.WriteFile(filepath) End If End IfEnd Sub
Dim root As String = "d:\temp\"
Dim filepath As String = Request.Params("file")
filepath=System.Web.HttpUtility.UrlEncode(System.Text.Encoding.UTF8.GetBytes(filepath));
If Not filepath Is Nothing Then
If File.Exists(filepath) And filepath.StartsWith(root) Then
Dim filename As String = Path.GetFileName(filepath)
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", _
"attachment; filename=""" & filename & """")
Response.Flush()
Response.WriteFile(filepath)
End If
End IfEnd Sub
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
/>
然后再修改:
Response.AddHeader("Content-Disposition", "inline;filename="+ System.Convert.ToChar(34) + FileName + System.Convert.ToChar(34) );还不行的话把你的代码贴出来