CustomErrors statusCode 500

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jesse Napier

    #1

    CustomErrors statusCode 500

    I have a customerrors section in web.config something like the following:

    <customErrors mode="On" defaultRedirect ="/errorPage/errorpage.aspx" >
    <error statusCode="404 " redirect="/errorPage/errorpage404.as px" />
    <error statusCode="500 " redirect="/errorPage/errorpage500.as px" />
    </customErrors>

    This works fine, but every exception in the app that isn't a 404 error gets
    redirected to the statusCode 500 page which represents an Internal Server
    Error. Is this standard?

    Why doesn't the defaultRedirect page ever get redirected to?

    I have a test page that throws an argumentExcepti on and I get redirected to
    errorPage500.as px. I want this type of exception to go to errorPage.aspx
    which is the default.

    Any help would be appreciated.

    Thanks,
    Jesse


  • Jerry III

    #2
    Re: CustomErrors statusCode 500

    That's because an uncaught exception results in 500 error. The default error
    page will be used for errors that do not have a page associated with them,
    in your case everything else than 404 and 500.

    Jerry

    "Jesse Napier" <jnapier@giants oftware.com> wrote in message
    news:eyCXRpQXDH A.2328@TK2MSFTN GP12.phx.gbl...[color=blue]
    > I have a customerrors section in web.config something like the following:
    >
    > <customErrors mode="On" defaultRedirect ="/errorPage/errorpage.aspx" >
    > <error statusCode="404 " redirect="/errorPage/errorpage404.as px" />
    > <error statusCode="500 " redirect="/errorPage/errorpage500.as px" />
    > </customErrors>
    >
    > This works fine, but every exception in the app that isn't a 404 error[/color]
    gets[color=blue]
    > redirected to the statusCode 500 page which represents an Internal Server
    > Error. Is this standard?
    >
    > Why doesn't the defaultRedirect page ever get redirected to?
    >
    > I have a test page that throws an argumentExcepti on and I get redirected[/color]
    to[color=blue]
    > errorPage500.as px. I want this type of exception to go to errorPage.aspx
    > which is the default.
    >
    > Any help would be appreciated.
    >
    > Thanks,
    > Jesse
    >
    >[/color]


    Comment

    • Jesse Napier

      #3
      Re: CustomErrors statusCode 500

      Thats what I thought. But can other exceptions result in a 500 error or can
      I be confident that any 500 error was an uncaught exception.

      I am handling uncaught exceptions in the appliacation_er ror event and I just
      want to make sure that the user gets redirected to a friendly page so I let
      the redirection be handled by the custom errors redirection in web.config.

      Does that make sense?


      "Jerry III" <jerryiii@hotma il.com> wrote in message
      news:#$EGEbRXDH A.608@TK2MSFTNG P12.phx.gbl...[color=blue]
      > That's because an uncaught exception results in 500 error. The default[/color]
      error[color=blue]
      > page will be used for errors that do not have a page associated with them,
      > in your case everything else than 404 and 500.
      >
      > Jerry
      >
      > "Jesse Napier" <jnapier@giants oftware.com> wrote in message
      > news:eyCXRpQXDH A.2328@TK2MSFTN GP12.phx.gbl...[color=green]
      > > I have a customerrors section in web.config something like the[/color][/color]
      following:[color=blue][color=green]
      > >
      > > <customErrors mode="On" defaultRedirect ="/errorPage/errorpage.aspx" >
      > > <error statusCode="404 " redirect="/errorPage/errorpage404.as px" />
      > > <error statusCode="500 " redirect="/errorPage/errorpage500.as px" />
      > > </customErrors>
      > >
      > > This works fine, but every exception in the app that isn't a 404 error[/color]
      > gets[color=green]
      > > redirected to the statusCode 500 page which represents an Internal[/color][/color]
      Server[color=blue][color=green]
      > > Error. Is this standard?
      > >
      > > Why doesn't the defaultRedirect page ever get redirected to?
      > >
      > > I have a test page that throws an argumentExcepti on and I get redirected[/color]
      > to[color=green]
      > > errorPage500.as px. I want this type of exception to go to errorPage.aspx
      > > which is the default.
      > >
      > > Any help would be appreciated.
      > >
      > > Thanks,
      > > Jesse
      > >
      > >[/color]
      >
      >[/color]


      Comment

      • Michal A. Valasek

        #4
        Re: CustomErrors statusCode 500

        | Thats what I thought. But can other exceptions result in a 500 error or
        can
        | I be confident that any 500 error was an uncaught exception.

        Generally yes. Under normal circumstances, 500 is thrown via exception. The
        second way how you can get 500 is when IIS or ISAPI application fails. But
        such situation is not standrd and in such case you cannot catch this
        situation, because it's not running.

        --
        Michal A. Valasek, Altair Communications, http://www.altaircom.net
        Please do not reply to this e-mail, for contact see http://www.rider.cz


        Comment

        Working...