IIS 7 and Above
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|davidtg|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|cmorrissey|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|davidtg|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|cmorrissey|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|dbhiis|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|steve schofield|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|KimKman|LINK
Wow! At last ... I have full Classic ASP errors and custom 404 handler.
Thanks much, works great.
Dec 18, 2008 08:36 AM|riznick|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|AminaG|LINK
I found the solutions:
Aug 27, 2009 07:17 AM|floppyho|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"
Aug 30, 2009 09:49 PM|BrownGhost|LINK
I cant, when i try it i get a.. lock violation ;(
Aug 31, 2009 01:39 PM|BrownGhost|LINK
the escy way to do it...
Go to Errors list
Now add new error called 500.100
Set it to exceute and add the patch: like /error/error.asp
now you will get your own error file, and server will exceute it..
and Server.GetLastError() works :o)
Aug 31, 2009 06:21 PM|floppyho|LINK
Editing specific errors does not work for me. I end up with blank emails. The only thing that seems to work for me is "Edit Feature Settings".
It's properties box is somewhat similar to the specific error properties box, but it actually works.
Thank you again AminaG
Sep 03, 2010 09:59 PM|BobBobson|LINK
Is there a specific bug documented for this with Microsoft somewhere? I searched support KB and haven't found anything. It makes it difficult to determine if it is a rumor of a bug, if there is a fix, etc. I am experiencing the same issue -- that is,
no information in the ASPError object returned by Server.GetLastError in a classic asp error handler assigned to handle the 500 status error. I am not using the default error page accessible within feature settings because since it appears to be a work around
for a bug with the GetLastError call when the error handler page, with Execute Url option set for the 500 status. The error handler code was not changed when moved form the IIS6 server to the IIS7.5 server but the functionality changed (the error information
was no longer included in the report). The application pool mode was changed to integrated pipeline-- although I don't know if the execution pipeline mode even impacts classic asp execution much. Any information would be appreciated (beyond assigning the
default error page option).
Feb 10, 2012 10:24 AM|ultreia|LINK
This was the solution!! 500.100 filter error!
Thank you very much!
May 02, 2012 03:21 PM|ashrael|LINK
If you receive a lock violation error when trying to modify "Error Pages: Edit Feature Settings....", open the file %windir%\System32\inetsrv\config\applicationHost.config. (If having problems opening the file, run Notepad as Administrator and you should
be able to open it.)
Save, and the lock problem will go away :)