|
-
February 1st, 2010, 06:11 AM
#1
[RESOLVED] HttpException not handled
I seem to be having problems loading my ErrorPage. I received the error message: "HttpException not handled". I then added a catch statement expecting a specified message to be written on my screen. Instead I again received the same message but this time my HttpException error mssage was highlighted. I would like to know the following:
1. I handled HttpExceptions so why do I still receive an error message instead of my own error message text appearing on the screen?
2. My error page is called ErrorPage.aspx and is not in any particular folder and has the same namespace as the other pages so why doesnt it work?
3. Could there be any errors in the method below which determines the error message type?
Code:
public void DisplayErrorMsg()
{
// In case of error redirect to error page
for (int i = 0; i < listError.Count; i++)
{
if (listError[i] == currentError)
{
try
{
Response.Redirect("ErrorPage.aspx", true); //ORIGINAL ERROR
}
catch (HttpException)
{
Response.Write("Fehlerseite wurde nicht gefunden."); //LATER ERROR HERE
}
catch (Exception)
{
Response.Write("Fehlerseite enthalt Fehler");
}
}
}
// Determine error message
if (currentError == "401")
{
lblErrorCode.Text = "Fehlercode: 401";
lblErrorMsg.Text = "Zugang zur Seite nicht erlaubt.";
lblErrorCode.Visible = true;
lblErrorMsg.Visible = true;
}
else if (currentError == "404")
{
lblErrorCode.Text = "Fehlercode: 404";
lblErrorMsg.Text = "Seite nicht gefunden.";
lblErrorCode.Visible = true;
lblErrorMsg.Visible = true;
}
(ETC)
else
{
lblErrorCode.Text = "Ein Fehler ist aufgetreten.";
lblErrorCode.Visible = true;
lblErrorMsg.Visible = false;
}
}
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|