Response is not available in context? How to solve it?

后端 未结 2 468
暗喜
暗喜 2020-12-20 09:04

I save a pdf file to stream. I want to save the stream to Response stream. But it always throw error:Response is not available in contex.

Here is the code:



        
2条回答
  •  余生分开走
    2020-12-20 09:45

    You are starting new thread to process request, but your original thread likely continues execution and successfully terminates request before your new thread even gets to doing something with the response. You have to wait for completion of the new thread in the original thread (you may be able to creatively use asynchronous pages to not block original thread http://msdn.microsoft.com/en-us/magazine/cc163725.aspx).

提交回复
热议问题