IIS 7 & IIS 8
IIS7 Custom 500.asp page and GetLastError not working
Last post May 02, 2012 03:21 PM by ashrael
Jul 17, 2008 11:20 PM|LINK
I've migrated a classic-ASP site from IIS6 to IIS7. One issue I'm still having is a custom 500.asp error page. The page shows fine on a 500 error but it calls Server.GetLastError() and should display the many values returned. Unfortunately now in IIS7 there
doesn't seem to be any info available. All worked fine in IIS6.
I've tried many settings for the site in the IIS 7 Manager but so far nothing has changed this behavior.
Any help appreciated, David
Jul 18, 2008 11:07 AM|LINK
I'm having the same issue - and have read that this was a bug in iis7 in Vista which would be fixed in SP1 - I'm assuming it has not been fixed in the final release of windows 2008. I'll keep you updated if I find anything else. If you do get a work around,
let me know.
Jul 18, 2008 11:33 PM|LINK
I may have found a workaround for my issue depending on what else you've got setup.
In the IIS7 Manager open the site's Error Pages and select "Edit Feature Settings....". You get the popup for:
Edit Error Pages Settings - I populated the (was blank) Default Page -
Path type: Execute URL
This doesn't seem to override a 404 error but 500-script/database errors get redirected to this page. I'm unsure but seems similar to setting a "Custom Error" 500 page. But the above page does fire regardless of setting for Custom 500 Error page - I set
the 500 error back to IIS default and my /500.asp page still fires. I'll guess this must have similar effect to settings in ASP.NET's web.config file for <error> handling (?).
Importantly, now the values of Server.GetLastError() are fully populated and displayed on the 500.asp error page.
I'll admit I'm unsure as to the full ramifications of setting the Default Page in the Error Pages to be my 500.asp page but so far it seems to be working as desired.
Jul 21, 2008 10:15 AM|LINK
Thanks for this - that worked for me. Although it does not seem ideal to have this set for all error pages, especially since you have no way of knowing when its going to be executed as it does not override the 404 errors. Very strange, but at least it work.
Sep 18, 2008 01:20 AM|LINK
I am using the above setup to pass the error to a custom 500 page, however my 404 goes to the custom 404 etc.
Are you still having all errors sent to your 500 page?
Sep 18, 2008 06:36 PM|LINK
Just curious, did you try setting your application pool to Classic mode and see if the errors display properly?
Windows Server MVP - IIS
Log archival solution
Install, Configure, Forget
Dec 04, 2008 04:21 AM|LINK
Wow! At last ... I have full Classic ASP errors and custom 404 handler.
Thanks much, works great.
Dec 18, 2008 08:36 AM|LINK
You were able to get it to work?
I need step by step instructions to get an email with the specific error information when an error happens in classic asp. I have tried just about everything and am considering switching back to windows 2003 server.
The code also handles very differently. For example, I tell it to name the page and post/get variables. It now lists only the error page and it puts the page with the error in a querystring.
Currently I get a blank email
Custom Error Message
Custom Error Message
Aug 04, 2009 02:05 PM|LINK
I found the solutions:
Aug 27, 2009 07:17 AM|LINK
Thanks AminaG, that worked. Strange how it doesn't work when you doubleclick the error pages for properties and do the exact same thing.
The solution was in "Edit Feature Settings"