IIS7 Integrated Pipeline - Response.End not ending the request
I开发者_Python百科 have the following bit of code that worked as expected before we upgraded to Integrated Pipeline in IIS7.
public void RedirectPermanently(string url, bool clearCookies)
{
Response.ClearContent();
Response.StatusCode = 301;
Response.AppendHeader("Location", url);
if(clearCookies)
{
Response.Cookies.Clear();
Response.Flush();
Response.End();
}
}
Previously when this method was executed, if clearCookies was true, the response would be sent to the client and request processing would end. Now under Integrated Pipeline Response.End() does not seem to end processing. The page continues running as if the method was never called.
Big question is, why and what changed!
Thanks.
Response.End
will only raise ThreadAbortException
when HttpContext.IsInCancellablePeriod
is true.
One side effect of Response.Flush()
is that is causes HttpContext.IsInCancellablePeriod
to become false when executing in integrated pipeline mode.
Try removing Response.Flush()
from your code. Ending the response will cause the response stream to be flushed anyway.
精彩评论