views:

16

answers:

1

Hello people !

I'm having some trouble when people try to log on my system in IE8. Before tomorrow everything is fine, but now when they try to log on the line who call RedirectFromLoginPage method throws ThreadAbortException exception.

After some investigating i found that if i change createPersistentCookie to false they can log normally.

There is anyone to help me with some ideias why this is occurring ?

Thanks everyone and sorry my english !!

A: 

ThreadAbortException is thrown in order to stop the execution of a thread. It's not an error in itself. When a redirect is done immediately (without completing the request) a ThreadAbortException is thrown to accomplish this.

Carl R
And how do i solve this ? In firefox all is working normal ..
Thiago Bernabé
Sorry, I've must have misunderstod. I thought you had an overly aggressive error handler that caught that exception instead of just letting it do it's work.
Carl R
Is there any inner exception?
Carl R
I converted the exception to string and here is it: "System.Threading.ThreadAbortException: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End() at System.Web.HttpResponse.Redirect(String url, Boolean endResponse) at System.Web.HttpResponse.Redirect(String url) at MyMethod"
Thiago Bernabé
Do you catch the exception and display an error? Try not to. That ThreadAbortException is analogous to a return statement, but ThreadAbortException bubbles through nested function calls. If you need to have a try catch around that code, catch specific exceptions, not System.Exception.
Carl R
If you find the above explanation lacking, please google Response.End and ThreadAbortException. Response.End works by throwing that exception which should terminate your code on that thread (that request) up until it reaches the Aspnet engine that performs the redirect. When the Threadabort is caught and treated like a normal exception, the immediate redirect won't work. :)
Carl R