mcgants
asked on
Generic error trapping
Hello,
Is there any way of providing an application-wide try-catch or does it have to be done on each web page seperately?
I currently provide a generic error message caught by using customErrors in web.config but it would be nice if the user didn't have to quit the application and re-start.
As an aside, i would also like to the webapp to send information to me via email if an error occurs - any useful functions/ thoughts on how to do this?
Thanks in advance,
mcg
Is there any way of providing an application-wide try-catch or does it have to be done on each web page seperately?
I currently provide a generic error message caught by using customErrors in web.config but it would be nice if the user didn't have to quit the application and re-start.
As an aside, i would also like to the webapp to send information to me via email if an error occurs - any useful functions/ thoughts on how to do this?
Thanks in advance,
mcg
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Just replace my settings with your own.
Also, to make sure users do not see any asp.net error descriptions you can make your own html page which is displayed when an error occurs.
In your web.config file:
<customErrors defaultRedirect="error.htm " mode="RemoteOnly" />
error.htm is the page that will be displayed when an error occurs and it could say something like "Admin has been notified - try again later etc.
regards,
KS
In your web.config file:
<customErrors defaultRedirect="error.htm
error.htm is the page that will be displayed when an error occurs and it could say something like "Admin has been notified - try again later etc.
regards,
KS
ASKER
thanks, that's great it works well, but before i finish, do you know if there is a resolution for the first part of my question:
"I currently provide a generic error message caught by using customErrors in web.config but it would be nice if the user didn't have to quit the application and re-start."
i'm thinking of a roll-back kind of thing where once an error has been generated, putting the user back to where they were. maybe i'm hoping for a bit too much, but the email message works a treat :)
cheers,
mcg
"I currently provide a generic error message caught by using customErrors in web.config but it would be nice if the user didn't have to quit the application and re-start."
i'm thinking of a roll-back kind of thing where once an error has been generated, putting the user back to where they were. maybe i'm hoping for a bit too much, but the email message works a treat :)
cheers,
mcg
Hmmm. You could put them back but they would still encounter the error if they attmepted to repeat the operation which caused it.
Perhaps you could put a link on your custom error page to take them back manually - or a redirect?
regards,
kS
Perhaps you could put a link on your custom error page to take them back manually - or a redirect?
regards,
kS
ASKER
no worries, i was just trying to keep the app up and running through the error, but the code you've given me for the email was great. thanks!
okay, no probs.
All the best,
kS
All the best,
kS