Problem with Response.Redirect in try catch block in asp.net using C#

Nov 20 2004 2:16 AM
1. I'm having form1 which in turn redirects to form2 using 'Server.Transfer', because i want to retrieve form1 values from form2. 2. I have used try,catch block in both the forms. 3. Now i'm getting an exception in form2 which in turn enters the catch block, where i'm redirecting the page to the common error page using either Server.Transfer or Response.Redirect. 4. While executing this particular line of statment in the catch block it got up with the SystemException saying 'Thread was being aborted' How to handle this situation. Sample code used: WebForm1: public class WebForm1 : System.Web.UI.Page { protected System.Web.UI.WebControls.TextBox TextBox1; private string m_TestValue; private void Page_Load(object sender, System.EventArgs e) { try { TextBox1.Text = "TestBox"; Server.Transfer("WebForm2.aspx"); } catch(Exception exp) { Response.Redirect("WebForm3.aspx"); } } public string TestResult { set { m_TestValue = value; } get { return m_TestValue; } } } /////////////////////////////////// WebForm2: public class WebForm3 : System.Web.UI.Page { private SystemException sysExp; private void Page_Load(object sender, System.EventArgs e) { WebForm2 obj; try { obj = (WebForm1)Context.Handler; Response.Write(obj.TestResult); sysExp = new SystemException("Test Exception"); throw sysExp; } catch(Exception exp) { Response.Redirect("WebForm3.aspx"); } } } Thanks in advance with regards, murugan.c