Reputation: 1
Code is :
Response.Redirect("~/Admin/uploadMaterials.aspx",false);
After this redirect line is executing page is loading, not redirecting to uploadMaterials.aspx
Upvotes: 0
Views: 971
Reputation: 101652
From the MSDN documentation:
Redirect calls End which raises a ThreadAbortException exception upon completion.
You should catch and ignore the ThreadAbortException
, and then your redirect should work:
try
{
// Code that calls Response.Redirect
}
catch (ThreadAbortException)
{
// Do nothing
}
catch (Exception e)
{
// Handle other exceptions
}
Upvotes: 1
Reputation: 2522
You can use server.transfer instead (or use the Response.redirect(....,true) to quit running the current page code and go to the next - but I have had a few GPF as a result.
Upvotes: 0