开发者

Classic ASP - Error Catching

开发者 https://www.devze.com 2023-03-28 04:59 出处:网络
I\'m working on a site and to help catch errors that we may not hear about, I\'ve created a custom 500 error page.

I'm working on a site and to help catch errors that we may not hear about, I've created a custom 500 error page.

This page basically records information about the current situation and logs it including the following:

Request.Servervariables("URL")

But, the log seem to actually be providing inform开发者_如何转开发ation about the location of the error.asp file instead of the actual file causing the error. And it doesn't seem to pick up Server.GetLastError().

Any ideas on how to ensure these scripts pick up the errors and deatils about the page causing the error and not the page that is used for 500 errors?

NOTE: When there's an error, the url in the address bar is always the address fo the page causing the error, but the log shows the error handler page 'error.asp'.


I would follow what Dee said, but also be aware that there was something finicky with IIS7 (or 7.5). I can't remember exactly, but you have to do something special to make sure it works on IIS7. Check out this article. IIS7 breaks the server.getlasterror and there is a workaround provided.

Also a cool thing to do is to email yourself those errors. So in your custom 500 asp script just fire off an email with the details. Depends on how critical errors are to your program, but it's good to be in the loop rather than have another log to worry about.

0

精彩评论

暂无评论...
验证码 换一张
取 消