Click to See Complete Forum and Search --> : Problems with Response.Redirect


hobbes
04-21-2005, 09:11 AM
Hello,

I have a page wherein the user does all the activity he needs to do and the saves the changes. He then clicks the Log off button, I need to redirect the page to the Login page.

This is what I do, and somehow it does not work. The following is the code snippet -

private void btnLogOff_Click(object sender, System.EventArgs e)
{
try
{
Session.Abandon();
//Server.Transfer("Login1.aspx");
Response.Redirect("Login1.aspx");
}
catch(Exception ex)
{
ErrorDiv.InnerText = ex.Message;
}
}

When I add ex to watch point and get its value the value is Thread was being aborted.

I can understand that this thread is being aborted because of the Session.Abandon(). (Am I correct on this?)

Please do advise as to how to acheive the same?

Thanks in advance.

Hobbes