Wrox Programmer Forums
|
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 31st, 2009, 03:15 AM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default ApplicationException

When there is an ApplicationException is thrown, the browser displays the actually code error in the web browser rather than redirect to the Error Page.
Is this suppose to happen?
An example when an ApplicationException occurs is when BrowseArticle.aspx is not given an ID.

The exception could be caught in the BasePage, and be redirected to Error.aspx. But I am wondering why the exception was not caught in the first place.
 
Old March 31st, 2009, 08:33 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

It absolutely should be being caught in the global default exception handler and routed to Error.aspx. If that's not happening for you, something's wrong.

Do you have <customErrors> set up correctly?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 1st, 2009, 07:21 AM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I didn't make any changes in the web.config file for error catching.
It catches the error for other type of Exceptions, but not ApplicationException. I must have changed something.
 
Old April 1st, 2009, 07:30 AM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I downloaded a new copy of the Project, and the same problem occur. It's not just ApplicationException its any Exceptions that gets thrown in the Page_Load method.
 
Old April 1st, 2009, 10:06 AM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

That doesn't really answer my question. Do you have customErrors set up correctly, or not?
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 1st, 2009, 02:00 PM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

This is what I have in web.config for the errors. I don't know what other setup do I need?

<customErrors mode="RemoteOnly" defaultRedirect="~/Error.aspx">
<error statusCode="404" redirect="~/Error.aspx?code=404"/>
<error statusCode="408" redirect="~/Error.aspx?code=408"/>
<error statusCode="505" redirect="~/Error.aspx?code=505"/>
</customErrors>
 
Old April 1st, 2009, 02:15 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

Well, "RemoteOnly" means exceptions thrown by local requests will not be handled. Since you are probably debugging the site on your local machine, this is why the redirect to Error.aspx is not taking place.

Set mode="On" and give it another try.

<shamelessPlug>
P.S. You might also consider picking up my new Blox coming out in a couple of weeks. It deals with all of this exception handling stuff in great detail.
</shamelessPlug>

__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}
 
Old April 1st, 2009, 05:29 PM
Registered User
 
Join Date: Mar 2009
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks it works, but I should keep it on RemoteOnly for debugging purposes.
I'll check out your new blog when it comes out.
 
Old April 1st, 2009, 05:37 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

You're welcome.

P.S. (not a blog, but a Wrox Blox that you will be available from this site.)
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

Code:
if (this.PostHelpedYou)
{
   ClickThanksButton(); 
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
ApplicationException vs. Exception tkubaska BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 13th, 2004 09:15 PM
Inherit Exception or ApplicationException organicglenn BOOK: ASP.NET Website Programming Problem-Design-Solution 3 March 27th, 2004 10:42 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.