Saturday, March 31, 2012

web.config error handling

Hi y'all,

I placed this piece of code in my web.config. I used a aspx-page because i want to store the url + time of error in my datase. Isn't this possible/ has it to be a html page because i don't get redirected to my page but to a page visual studio generated.

<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.
-->
<customErrors mode="RemoteOnly" defaultRedirect="onderhoud.aspx">
<error statusCode="403" redirect="onderhoud.aspx" />
<error statusCode="404" redirect="onderhoud.aspx" />
</customErrors>

section enables configuration of what to do if/when an unhandled error occurs during the execution of a request. Specifically, it enables developers to configure html error pages to be displayed in place of a error stack trace. -->

you are testing this on the Server right? The "RemoteOnly" stops it from happening on your localhost/dev machine...

Otherwise, yes...this should work.

0 comments:

Post a Comment