Click here to Skip to main content
15,882,315 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In my project I am getting some errors and exceptions, like session, connection failed, exception, and I do not want see the error messages.

Instead I want to redirect to login page so I have written the following code, but the problem is that it's showing the error and when I am clicking the stop button from the visual studio 2.0.
Then its redirects to the login page.

I have used both the global a sax and web.config
void Application_Error(object sender, EventArgs e)


<customerrors mode="On" defaultredirect="~/Login.aspx">
<error statuscode="404" redirect="~/Login.aspx">
<error statuscode="403" redirect="~/Login.aspx">
<error statuscode="401" redirect="~/Login.aspx">
<error statuscode="500" redirect="~/Login.aspx><br mode=" hold=" /></error></customerrors><br mode="></error></error></error></error></customerrors>

[edit]HTML section characters escaped - use the option below the text box when pasting HTML or it will not be readable - OriginalGriff[/edit]
Updated 9-Nov-10 21:38pm
Dalek Dave 10-Nov-10 3:38am    
Edited for Grammar and Readability.

1 solution

A great Tutorial[^] for you for handling unhandled Exception.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900