Forums

ASP

This topic is locked

Custom errors/error trapping

Posted 29 Jan 2010 22:30:31
1
has voted
29 Jan 2010 22:30:31 dave blohm posted:
OK, I'm usually on the answering side, but I'm trying to do something and I just can't seem to find it on my own. Any help is greatly appreciated.

I'm trying to do some error handling in classic ASP that will not only give me the error type and code, but the line number as well. I've looked at several different methods for trapping errors such as Err and GetLastError but have not been able to make anything gel. Anybody have an example of how to implement?

Thanks again.

Replies

Replied 03 Feb 2010 18:54:37
03 Feb 2010 18:54:37 Patrick Woldberg replied:
There are 2 ways for error handling, you can do a try/catch, in VBScript you can do it with On Error Resume Next.

The other way is to assign a 500:100 error page in IIS, link it to your own asp file. There you can use the GetLastError to get the error and show it the way you want. For example you could tell the user something went wrong and send an email to yourself with the actual error that was generated. That way the user can't see the actual error and is shown a friendly message and you know directly what wend wrong
Replied 04 Feb 2010 16:59:59
04 Feb 2010 16:59:59 dave blohm replied:
thanks!

Reply to this topic