使用Response.WriteFile下载文件出现的奇怪问题!请各位指点指点!
各位好,我使用Response.WriteFile方法下载EXCEL文件.代码如下:
Public Sub DownloadFile(ByVal strFileName As String, ByRef Response As HttpResponse)
Dim filePath As String
Try
Response.Write("<script>alert('DownloadFile!');</script>")
filePath = "C:\tmp\"
Response.Clear()
Response.ContentType = "application/octet-stream"
Response.AddHeader("Content-Disposition", "attachment; FileName=" & strFileName)
'Response.Buffer = True
Response.WriteFile(filePath & strFileName)
Response.Flush()
'Response.Close()
Response.End()
Catch ex As Exception
End Try
End Sub
文件可以下载到本地,但是却不能刷新客户端,即alert('DownloadFile!');脚本没有执行,请问这是什么问题呢?