How not to abort http response c#

前端 未结 8 688
刺人心
刺人心 2020-12-18 03:34

I need to run several methods after sending file to a user for a download. What happens is that after I send a file to a user, response is aborted and I can no longer do any

8条回答
  •  -上瘾入骨i
    2020-12-18 04:16

    As the previous answers had stated - returning PDF file means to send HTTP headers. You cannot send another headers after that, and Response.Redirect() simply means to send HTTP 302.

    If you don't want to have separate page, or if you don't want to use AJAX, why not trying:

    
        
    
    

    Actually this will show the desired page you want to show to the user, and will refresh the page after 3 sec with the URL for download of the PDF file.

提交回复
热议问题