General solution to handle web application errors?

woojtii

Newcomer
Joined
Jun 15, 2006
Messages
13
Hello,


We have many web applications on our web server (Windows 2003 IIS 6.0).




We would like to have one solution to handle all web application errors:


- Redirect to general error website

- Send e-mail alert to server admin



We do not have access to source code of all our web applications (ASP.NET), so we cannot always handle errors in source code.




Do you know any good solution for this scenario?




One of our ideas was to set custom error section in web.config files, and redirect users to ASP.NET web application.


This application has to display user-friendly message and send email.



The problem is that such web page is potentially security hole!

Anyone can access such page and generate hundreds of email messages.




Maybe is it workaround for this?




Thanks!


Wojtek
 
Hello,


We have many web applications on our web server (Windows 2003 IIS 6.0).




We would like to have one solution to handle all web application errors:


- Redirect to general error website

- Send e-mail alert to server admin



We do not have access to source code of all our web applications (ASP.NET), so we cannot always handle errors in source code.




Do you know any good solution for this scenario?




One of our ideas was to set custom error section in web.config files, and redirect users to ASP.NET web application.


This application has to display user-friendly message and send email.



The problem is that such web page is potentially security hole!

Anyone can access such page and generate hundreds of email messages.




Maybe is it workaround for this?




Thanks!


Wojtek


Your best bet is to create the custom errors event in the web.config file (as you suggested). The drawback here is that all you can really log is what page had an error and what time. The ideal situation is to find a way to access the code and use try/catch statements.

To prevent the security problem with many e-mails being sent, use the HTTP_REFERER server variable to make sure it was actually sent from within. Although, with having multiple sites like that, I'm not sure if the HTTP_REFERER variable will always be there.

I always log errors with a function, which I usually call Error_Handler. I log what page it happened on, What date/time it happened and what the exception was. I parse out the exception to give me the exception type and only the first few sentences of the error message and then the last sentence. I can't think exactly how it looks right now, so this is off the top of my head.

I hope this helps. You might have more luck if you post this in the ASP.NET portion of the forum.

Best of Luck!

~Derek
 
Back
Top