What will happen in the following scenario? Will it throw work after response.redirect?
Or do I need to use Response.Redirect in catch block of main method where it throws exception call stack….
try
{
//code
}
catch(Exception ex)
{
Response.Redirect("Error.aspx");
throw;
}
Since you aren’t supplying the parameter to indicate whether the current page should continue executing, it will automatically terminate the page by calling End(). Using the method with a single parameter is the same as calling the method with two parameters, with the second (endResponse) set to
true. Since End() results in an exception being thrown, it won’t ever reach your throw statement.Reference: http://msdn.microsoft.com/en-us/library/a8wa7sdt.aspx
If you want the page to continue executing you need to use the signature with two parameters and set the endResponse parameter to
false.