In classic ASP, is there a way to handle error at application level?
Is there guidelines for handling error / exceptions in classic ASP 3 ? The Server.GetLastError() not a lot to work with…
I am looking for something like the Application_Error()
found in an ASP.Net Global.asax.
Any equivalent in a global.asa ? Classes to intelligently log the error ? Like an old Enterprise library exception handling for ASP3…
Hey, I am a dreamer !
Thanks a lot for any pointers
Best Answer
Can be emulated in vbscript as follows:
How does this work? The 'class_terminate' method will be called when the newly created instance goes out of scope. This happens either when the interperter hits the 'end with' statement or when the callstack gets unwinded due to an error. It's less pretty then the native python approach but it works quite well and isn't to ugly.
For top level error handling you can use the same technique. This time don't use the with statement but create a global instance of your error handler. Beware that the ASPError object provided server.getLastError() isn't the same as the vbscript err object and is only available after IIS has done its server.transfer to the 500:100 error handler and has come back to your page to collect the garbage. Example handler: