How to show a message and send a file using ASP.NET

后端 未结 2 1185
猫巷女王i
猫巷女王i 2021-01-21 13:41

I generate a set of letters in a file, but if there are errors then the file may be incomplete. I want to send the file anyway, but with a warning to the user. So I have this:

相关标签:
2条回答
  • 2021-01-21 14:10

    I would suggest to have a page which would instruct the users the file download will begin shortly and in this page, you can display any warnings.

    This page would make a separate request for the file, using JS / meta refresh and continue the download. You may also want to provide a direct link, if the download doesn't begin in specified time.

    0 讨论(0)
  • 2021-01-21 14:13

    You can't return HTML and another response (for file's stream) in single GET.

    You can return HTML and have link to download file there.

    0 讨论(0)
提交回复
热议问题