Anybody know why ASP.NET might not abort the current thread with a Response.End()?
Update: Reason being that there is code, albeit not well written, that is getting executed after Response.End(). I’ve never seen a case where Response.End () didn’t stop the current thread from executing.
protected void Page_Load(object sender, EventArgs e)
{
Response.Clear();
Response.Redirect("somewhere", true);
Response.End();
//Some other code get's executed here
}
As you’ve pointed out, the method Response.End is defined as:
Debugging a fairly simple web app with a break point in the Page_Load method, I can see the call stack includes the line:
Reflecting into
CallHandlerExecutionStepI can see that the propertyIsCancellableis defined as:The default handler for .aspx pages is the output from the
PageHandlerFactorywhich implement IHttpHandler, not IHttpAsyncHandler – which would result inIsCancellablereturning true (as indeed it does in my test app).Have you configured a different HttpHandler in either your root web.config or one further up the stack to use an Async Handler instead? Are you using Update Panels with Partial Postbacks for example?