Thread was being aborted

L

Loui Mercieca

Hi,

I have a login page, and after i validate a username and password i use a
response.redirect to the default page. The username and password are stored
in an sql db. In the response.redirect i use some session variables to be
added in the query string. However i am getting a "Thread was being
aborted.". Any ideas why this could happen?

Thanks inadvance.
 
S

Solo

hi

You should not include the code "Response.redirect.. " in the code blok
"Try {} catch{}"
Sample:
try
{
//deal with the login logic
}
catch(Exception e)
{

}
Response.redirect("default.aspx");
 
L

Loui Mercieca

Thanks a lot, it worked. But out of curiosity, you know why the error was
raised?? what goes through the try-catch block that raised that error?
 
M

Mark Rae

Thanks a lot, it worked. But out of curiosity, you know why the error was
raised?? what goes through the try-catch block that raised that error?

It's a fairly common "gotcha". If you'd written:

Response.Redirect("default.aspx", false);

you wouldn't have got the error...
 
D

Daniel Walzenbach

Loui,

this is what happens:

"The Response.End method ends the page execution and shifts the execution to
the Application_EndRequest event in the application's event pipeline. The
line of code that follows Response.End is not executed.

This problem occurs in the Response.Redirect and Server.Transfer methods
because both methods call Response.End internally. "


This behavior is by design. You can read about it in
http://support.microsoft.com/default.aspx?scid=kb;[LN];312629


Does this information help you?

Daniel Walzenbach
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,824
Latest member
Nater888

Latest Threads

Top