Security.PrincipalPermission.Demand()

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,

Normally my programming style is as follows:

/****************/
if ( SomeObject.CanYouDoThis() == true)
SomeObject.DoStuff();
else
MessageBox.Show("Nope, sowwy...");
/****************/

Meaning, most usually I don't just call "DoStuff()" and show the 'nope
sowwy' message if I caught an exception.

Now, the question is: can someone explain why the
PrincipalPermission's Demand method seems to work like this? MS
recommends to try the Demand() method before you do something secure,
and catch any exception to handle non-authenticated users. This seems
a bit like misusing exceptions?

Thanks.

-Jeroen
.



Relevant Pages

  • Re: Madrid draw
    ... but I am making an exception this time. ... The old meaning of "prove" is more like test. ... the principle is arguing that the existence of an allowed ... For example, if our rule were 'all birds can fly', ...
    (rec.sport.tennis)
  • Re: Madrid draw
    ... but I am making an exception this time. ... The old meaning of "prove" is more like test. ... the principle is arguing that the existence of an allowed ... For example, if our rule were 'all birds can fly', ...
    (rec.sport.tennis)
  • Re: Convert Bitmap to byte* in C++
    ... CreateStreamOnHGlobal(NULL, true, &buffer); ... If we knew the type of 'bitmap', which is NOT an HBITMAP, or a CBitmap, it might be ... the nature of the exception. ... one of us could get meaning out of it. ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Madrid draw
    ... the meaning is something like "The search for an exception is how ... one tests the universality of a rule". ... I wasn't sure whether mimus was aware of that and was mentioning it as ... every rule has an exception. ...
    (rec.sport.tennis)
  • Re: Everything old is new again...
    ... (meaning following the manga) ... with the exception of actually ... giving the series an ending that Takahashi-sensei would not. ...
    (rec.arts.anime.misc)