locked
Custom error handling with .Net webpage RRS feed

  • Question

  • User1904105392 posted

    Hello,

     after searching for a solution of the bug of IIS7/IIS7.5 of not getting values in Server.GetLastError, I can't find a workaround. I was thinking on using a .Net webpage but in my first examples, when I assign a .Net page as the custom error page, the object exception is not there and it throws a NullException "Object reference not set to an instance of an object. " .

    How could I get information in Server.GetLastError ? I can't use the option of editing a global custom error page because if I do that I can't have authentication and other things.

    Tuesday, December 20, 2011 8:33 AM

All replies

  • User-1672167363 posted

    Hello,

    This is about ASP.NET Pages ?

    This is the IIS 7 Classic ASP Forum.

    Searching for solution for a "bug of IIS7/IIS7.5" ?

    Have you looked at Custom Error Pages http://learn.iis.net/page.aspx/267/how-to-use-http-detailed-errors-in-iis/ information.

    The problem error "object exception" might be the Application Pool and Settings:

    A word of caution: For architectural reasons, IIS 7.0 can only execute the URL if it is located in the same Application Pool.

     Use the redirect feature to execute a Custom Error in a different Application Pool.

    MSDN library http://msdn.microsoft.com/en-us/library/system.web.httpserverutility.getlasterror.aspx 

    C# Example:

    Exception LastError;
    String ErrMessage;

    LastError = Server.GetLastError();

    if (LastError != null)
       ErrMessage = LastError.Message;
    else
       ErrMessage = "No Errors";

    Response.Write("Last Error = " + ErrMessage);
      

    Can you post the IIS Server Status Codes or look at FRT.

    For the problems A and B look at the IIS Server Status Codes or FRT: 

    A) "I can't use the option of editing a global custom error page"

    B) "If I do that I can't have authentication and other things."

    You can post the Status Codes in the Forum.

    Martin


     

    Tuesday, December 20, 2011 7:00 PM
  • User1904105392 posted

    I will explain again. As you know, IIS7/IIS7.5 has a know bug by  Microsoft related with custom error ASP Classic using Server.GetLastError. If you configure custom errors by error code (404, 500, etc)  and not configure a default error page, you will have a empty Server.GetLastError. The workaround is configure a custom default error page but then you can't configure authentication. You can see what I am explaining here: http://www.tacticaltechnique.com/web-development/classic-asp-getlasterror-in-iis7/

     

    Now, I am looking for a real solution trying to handling classic ASP errors with a custom page but using a page wiht asp.net, could I get info of an ASP error with a .net page ? Also I only want to have info of the error, this is my real goal, so If I could get that with php, asp.net or classic asp it doesn't matter.

    Wednesday, December 21, 2011 3:27 AM
  • User-1672167363 posted

    Hello,

    Download  Fiddler2 and do the configuration  http://www.fiddler2.com/fiddler2/  capturing the events and errors.

    Use Wfetch http://support.microsoft.com/kb/284285 to make requests for ASP http://support.microsoft.com/kb/294271.

     I only want to have info of the error.  If that info with php asp.net classic asp it doesn't matter.

     

    Edit: Using PHP http://learn.iis.net/page.aspx/765/improve-php-error-messages-in-iis-7-and-above/ error messages in IIS Server.

    Martin

     

     

     

     

    Sunday, December 25, 2011 2:46 PM
  • User-1672167363 posted

    Hello,

    Custom error handling with .Net webpage:

    after searching for a solution of the bug of IIS7/IIS7.5 of not getting values in Server.GetLastError I can't find a workaround..

    I was thinking on using a .Net webpage but in my first examples, when I assign a .Net page as the custom error page,

    the object exception is not there and it throws a NullException "Object reference not set to an instance of an object. " .

    How could I get information in Server.GetLastError ?

    I can't use the option of editing a global custom error page because if

    I do that I can't have authentication and other things.

     I will explain again. As you know IIS7/IIS7.5 has a know bug

    You can see what I am explaining here   http://www.tacticaltechnique.com/web-development/classic-asp-getlasterror-in-iis7/ 

    Microsoft related with custom error ASP Classic using Server.GetLastError.

    If you configure custom errors by error code (404, 500, etc)  and not configure a default error page,

    you will have a empty Server.GetLastError.

    The workaround is configure a custom default error page but then you can't configure authentication.

    Now, I am looking for a real solution trying to handling classic ASP errors with a custom page

    but using a page wiht asp.net, could

    I get info of an ASP error with a .net page ?

    Also I only want to have info of the error, this is my real goal, so

     If I could get that with php, asp.net or classic asp it doesn't matter.

    I suggest for Bugs with ASP  ASP.NET PHP  and  IIS 7 / IIS 7.5  contact Microsoft Support http://support.microsoft.com/ 

    let the Experts know and they can help with the issues.

    Martin

     

     

     

     

    Sunday, January 8, 2012 2:34 AM