I have a site that uses alot of try catch finally strunctures when accessing data and determining the outcome. In the catch, in the case of an exception I do this:
catch (Exception ex)
{
Session.Add("sessionerror",ex.Message.ToString());
Server.Transfer("error.aspx");
}
Where the error page displays whatever is in the "sessionerror" session variable.
Well sometimes that works but sometimes the error.aspx content is simply added over the top of the existing content in the browser. For example I have a login page that has username and password textboxes. When logging in, if successful it does a redirect using Server.Transfer to another page that displays a couple of lists. If an exception occurs in the redirected page, the content of the error page is overlapped onto the login page.
Q1. Is Server.Transfer() the right function to use in general to redirect to the next page?
Q2. Why do I get Thread Being Aborted when I call Server.Transfer() in a TRY structure?
Q3. How can .NET overlap HTML content?
I have had a string of errors occur and .NET just overlaps several pages of errors without clearing the browser at all.
Any input would be appreciated.
Eric Kleeman - EDS Consulting Services
MCP Visual FoxPro
MCSD C#.NET
Hua Hin Thailand
Los Angeles California