How not to abort http response c#

前端 未结 8 708
刺人心
刺人心 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条回答
  •  清酒与你
    2020-12-18 04:08

    I believe what you are trying won't work.

    This is what I would do:

    1. Write content to a file locally and assign it an unique id
    2. send user to the next page that contains a hidden frame that perform a request with the unique id (javascript)
    3. hidden request page loads file and push on the content stream.

    This is the same behavior a lot of file download sites is using. Only issue is if the hidden frame fails (javascript turned off) to perform the request, why a lot of the same sites have the link available if the auto request fails.

    Disadvantage: file cleanup.

提交回复
热议问题