Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect to custom page if error

Status
Not open for further replies.

rafal444

Programmer
Aug 11, 2006
74
US
I would like to redirect to a custom page when there is application error on the server. Can I do it globally?

This is the error:

Compilation Error
...
Compiler Error message: CVT1106: cannot write to file


 
1. Use try/catch blocks to code lines that they may raise an exception.
2. Then use a global error page to inform the users with a friendly message, by redirecting them to a custom made page. Please tell us your asp.net version that you use (1.1 or 2.0?).

Regards
 
A compile time error is going to blow up before users hit your page. Redirection shouldn't help much there.

That error looks like a visual studio locked file issue.

Brian Begy
BugSentry - Automatic error reporting for .NET and COM
 
What about changes to web.config? Will it work?
 
<<1. Use try/catch blocks to code lines that they may raise an exception.

I just need some global level error handling... Will this work in web.config?

<customErrors defaultRedirect="error.htm" mode="RemoteOnly" />
 
Application_error will do it for you, although there are some gotchas in getting the current, correct error.

Brian Begy
BugSentry - Automatic error reporting for .NET and COM
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top