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 February 22nd, 2010, 02:42 PM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default Where the SecurityException is beeing catched?

Code:
throw new SecurityException("You are not allowed to edit existent articles!");
On this line application breaks:
System.Security.SecurityException was unhandled by user code


I need to catch it some where, but where?
 
Old February 22nd, 2010, 04:39 PM
Lee Dumond's Avatar
Wrox Author
 
Join Date: Jan 2008
Posts: 923
Thanks: 12
Thanked 166 Times in 162 Posts
Default

If you let it pass, the ASP.NET default exception handler should catch it and show the error page as configured in web.config.

This is a really horrible use of exception handling anyway. I wouldn't even throw the exception at all. It would be better just to show a message on the page.
__________________
Visit my blog at http://leedumond.com
Follow me on Twitter: http://twitter.com/LeeDumond

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

Last edited by Lee Dumond; February 26th, 2010 at 10:50 AM..
 
Old February 22nd, 2010, 05:42 PM
Registered User
 
Join Date: Jan 2010
Posts: 9
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hmm, probably i am missing something in web.config...
What should I have there to make it work and not break into unhandled error?

And why this approach is horrible?





Similar Threads
Thread Thread Starter Forum Replies Last Post
Getting System.Security.SecurityException Sunnys ASP.NET 2.0 Professional 0 March 14th, 2007 04:13 AM
System.Security.SecurityException pastoda BOOK: Professional C#, 2nd and 3rd Editions 7 July 31st, 2005 08:49 AM
System.Security.SecurityException davepruce ADO.NET 1 May 10th, 2005 11:20 AM
'System.Security.SecurityException' Jesus VB.NET 2002/2003 Basics 0 November 4th, 2004 02:20 AM
'System.Security.SecurityException' mrinal ADO.NET 3 August 11th, 2004 07:16 AM





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