Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > CustomErrors statusCode 500

Reply
Thread Tools

CustomErrors statusCode 500

 
 
Jesse Napier
Guest
Posts: n/a
 
      08-07-2003
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.aspx" />
<error statusCode="500" redirect="/errorPage/errorpage500.aspx" />
</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 argumentException and I get redirected to
errorPage500.aspx. I want this type of exception to go to errorPage.aspx
which is the default.

Any help would be appreciated.

Thanks,
Jesse


 
Reply With Quote
 
 
 
 
Jerry III
Guest
Posts: n/a
 
      08-07-2003
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" <> wrote in message
news:...
> 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.aspx" />
> <error statusCode="500" redirect="/errorPage/errorpage500.aspx" />
> </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 argumentException and I get redirected

to
> errorPage500.aspx. I want this type of exception to go to errorPage.aspx
> which is the default.
>
> Any help would be appreciated.
>
> Thanks,
> Jesse
>
>



 
Reply With Quote
 
 
 
 
Jesse Napier
Guest
Posts: n/a
 
      08-07-2003
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_error 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" <> wrote in message
news:#$...
> 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" <> wrote in message
> news:...
> > 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.aspx" />
> > <error statusCode="500" redirect="/errorPage/errorpage500.aspx" />
> > </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 argumentException and I get redirected

> to
> > errorPage500.aspx. I want this type of exception to go to errorPage.aspx
> > which is the default.
> >
> > Any help would be appreciated.
> >
> > Thanks,
> > Jesse
> >
> >

>
>



 
Reply With Quote
 
Michal A. Valasek
Guest
Posts: n/a
 
      08-07-2003
| 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


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
return HttpStatusCode.ServiceUnavailable in the context.context.Response.StatusCode (Http response code 503) Flip Rayner ASP .Net 1 01-23-2007 06:35 AM
system() Statuscode Frank Liebelt C++ 3 03-08-2006 05:56 PM
custom error page for Statuscode 401.2 - Access Denied Rich ASP .Net 1 05-26-2005 03:24 PM
Confused about Response.StatusCode Shane ASP .Net 1 11-21-2003 11:27 AM
Response.StatusCode Shane ASP .Net 0 11-20-2003 04:44 PM



Advertisments