locked
IIS7 Custom 500.asp page and GetLastError not working RRS feed

  • Question

  • User693506143 posted

    Hi,

    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
     


     

    Thursday, July 17, 2008 7:20 PM

Answers

  • User693506143 posted

    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: /500.asp
            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.

    David

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 7:33 PM

All replies

  • User-131962155 posted

    Hi,

    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.

    Friday, July 18, 2008 7:07 AM
  • User693506143 posted

    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: /500.asp
            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.

    David

     

    • Marked as answer by Anonymous Tuesday, September 28, 2021 12:00 AM
    Friday, July 18, 2008 7:33 PM
  • User-131962155 posted

    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. Thanks again.

    Monday, July 21, 2008 6:15 AM
  • User6500891 posted

    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?

    Wednesday, September 17, 2008 9:20 PM
  • User1073881637 posted

    Just curious, did you try setting your application pool to Classic mode and see if the errors display properly?

    Thursday, September 18, 2008 2:36 PM
  • User707029322 posted

     Wow! At last ... I have full Classic ASP errors and custom 404 handler.

    Thanks much, works great.

    Thursday, December 4, 2008 12:21 AM
  • User-371117171 posted

    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

    AspCode:

    Category:

    File:

    Description:

    Source:

    Line: 0

    AspDescription:

    Custom Error Message

    Category:
    Number: (0x0)
    Source:
    Descripton:
    Line Number:

    Thursday, December 18, 2008 4:36 AM
  • User-2119471243 posted

    I found the solutions:

     

    http://www.tacticaltechnique.com/web-development/classic-asp-getlasterror-in-iis7/

    Tuesday, August 4, 2009 10:05 AM
  • User-208288087 posted

    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"

    Thursday, August 27, 2009 3:17 AM
  • User-445905779 posted

     I cant, when i try it i get a..  lock violation  ;(

    Sunday, August 30, 2009 5:49 PM
  • User-445905779 posted

    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)

     

     

    Monday, August 31, 2009 9:39 AM
  • User-208288087 posted

    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

    Monday, August 31, 2009 2:21 PM
  • User2144944596 posted

     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).

     

     

    Friday, September 3, 2010 5:59 PM
  • User1904105392 posted

     This was the solution!! 500.100 filter error!

    Thank you very much!

    Friday, February 10, 2012 6:24 AM
  • User1709416611 posted

    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.)

    Replace:

    <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">

    With:

    <httpErrors lockAttributes="allowAbsolutePathsWhenDelegated"> 
    Save, and the lock problem will go away :) 
    Wednesday, May 2, 2012 11:21 AM