Why don't PreSendRequestHeaders and PreSendRequestContent start?

When working with HTTP modules, did anyone notice that the last two events in the pipeline - PreSendRequestHeaders and PreSendRequestContent - do not always fire?

I checked that the code associated with EndRequest will run, but will not be bound to PreSendRequestHeaders or PreSendRequestContent.

Is there a reason? I thought this was a caching problem (with 304 Not Modified, you are not actually sending content ...), but I cleared the caches and decided that the server returns 200 OK, which indicates that it sent the content.

This is a problem because the StatusCode of the response defaults to 200, and I understand that it does not upgrade to something like 404 or 206 to those last two final methods. If I check StatusCode during EndRequest, it will always read 200.

+3
source share
3 answers

Is this related to the integrated IIS 7 pipeline?

To be checked, but I think thoses events only fire when IIS 7 runs in an integrated pipeline.

+1
source

I insert the header of the cookie on the PreSendRequestHeaders event and have not yet encountered the problem of its not firing ...

0

Perhaps this is due to HttpResponse.BufferOutput. If buffering is disabled, it seems that all the headers and some of the content have already been sent by the time these events fire.

0
source

Source: https://habr.com/ru/post/1705614/


All Articles