VB.net文件下载可防止回发

| 我想生成一个(报告)文件供用户下载,然后向用户显示一条消息,以显示该过程已成功完成。
Dim myFile As FileInfo = New FileInfo(<filepath>)

\'My function to generate a report (this can take a few minutes)
GenerateReport(myFile.FullName)

\'Prompt user with \"save as\" dialog box.
Response.Clear()
Response.ClearHeaders()
Response.AddHeader(\"Content-Disposition\", \"attachment; filename=\" & _
Response.WriteFile()

\'Give message to say generation is complete. (This line doesn\'t take effect)
lblMsg.Text = \"Generation complete\"
但是,当我使用创建一个“另存为”框时,似乎完全停止了该消息的显示。这是为什么?有人可以提出解决方法吗?     
已邀请:
看来这是一个很普遍的问题。但是,对于我所遇到的所有建议,似乎很少能提供任何解决方案。这是Rick Strahl博客中的有用文章。 一种有用的方法是MyWebClient.DownloadFile。这样就可以正常下载文件,但没有根据需要提供“另存为”对话框。     

要回复问题请先登录注册