First off! Love the book. I wish you wrote a part 2, 3, 4, etc and the Pro version because your style of writing makes it easy to learn!
Now my concern or more likely confusion. Been working with the global error handling touched on page 666-.
First off you say, "You can map different types of
errors (server errors, page not found errors, security problems, and so forth) to different pages"
Great. I have this working almost. But here's what I don't understand. Lets say I "on purpose in this case' just type some gibberish random characters in my default.aspx code behind page load event to force an error. Knowing that normally building/debuggin this I would catch this. But lets ignore for now. So I run the website and of course it won't load and in this case it doesn't come back with the default redirect defined page "othererrors.aspx" page but a YSOD version. with this set to "on" or "remoteonly" I still keep away the specifics of the error from the end user but why no redirect to, if nothing else, the defaultredirect page. I see this YSOB--->
Code:
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.
Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
The Global.ascx still sends the email with all the good info (strack trace, etc)
Code:
Exception Type: System.Web.HttpCompileException
Message: d:\Inetpub\wwwrootwebsite\Default.aspx.cs(12): error CS1002: ; expected
So my question is shouldn't even an error like this go to the default redirect page? Here's where i am confused. There is no HTML error per-say so I couldn't use a default custom error right because what status code would this be? This isn't technically an HTML error at all, right So per your quotes at the top...does capturing a server error or compile error like this not work with the custom error page setup? The 404 redirect works fine.
I hope I made sense. Thanks again.
-------------------------
So I used this nice HTTP Web Debugging Proxy software IE add-on called Fiddler2. It shows when I load the default.asxp file that it is returning a result return code of 500! So then I would think the web.config custom error entry for error500 would come up instead of the .Net YSOD. More confused ;-)