I browsed the source code of FormsAuthentication, and noticed it ends in
context.Response.Redirect(strUrl, false);
The ‘false’ parameter stands for “don’t terminate execution of the current page”.
Why wouldn’t a call to FormsAuthentication.RedirectFromLoginPage() need to terminate viewing the current page? What is the correct behavior after calling this method?
Setting “endResponse” to true means that the
Response.Redirect()call also forces a call toResponse.End().Response.End()will immediately transfer the code execution over to Application_EndResponse event, and raises aThreadAbortExceptionat the end of everything.Basically, it’s a cleaner “shutdown” of the response if you leave the parameter as false. If you can structure the logic of your method to basically finish right after the the Response.Redirect() call, you can avoid all the weird things that happen with forcing a Response.End().