I have a problem with a redirect in my code. None of the solutions proposed on the web has worked for me. Basically my code is this (not actual code, only description):
protected void btnCool_Click(object sender, EventArgs e)
{
GetDataFromInterface();
GetDataSpecificDataFromDB();
SaveDataOnSession();
Response.Redirect("SomePage.aspx", false);
Context.ApplicationInstance.CompleteRequest();
}
Everything executes nicely, but after the method executes I am just getting thrown to the login page. In the Output windows of VS I see this: "An exception of type 'System.Threading.ThreadAbortException' occurred in mscorlib.dll but was not handled in user code."
Here is some extra info:
- I am not using a try catch block.
- I don't have any UpdatePanels on this page, nor in the master page.
- Application_Error does not even trigger.
- I even have a second button that does almost the same thing (brings other data) and redirects successfully to another page (same code)
- I am not changing anything in the Web.Config during the execution.
Edit: For clarification. That exception is thrown no matter what. The redirect to the desired page does not work (that mean I have a dead part in my app. I can't get to it.). Instead I'm getting thrown out from the application.
Please, please help me out with this one. I really don't have any more leads that I could follow so any suggestion might be helpful.