Re: bug? -- PrincipalPermissionAttribute & GetCustomAttributes
From: Ivan Medvedev [MS] (ivanmed_at_online.microsoft.com)
Date: Thu, 26 Jun 2003 17:30:42 -0700
You can, however, use a tool called permview.exe (included in the SDK) to
view declarative security attributes.
This posting is provided "AS IS" with no warranties, and confers no rights
"Shawn Farkas [MS]" <email@example.com> wrote in message
> This refers to all declaritive security demands, any permission that you
> in an attribute will be unreadable through reflection.
> This posting is provided "AS IS" with no warranties, and confers no rights
> "lx" <firstname.lastname@example.org> wrote in message
> > Hi Shawn,
> > Unfortunately, nowhere in .NET Documentation, Microsoft warns
> > about this "peculiarity".
> > It seems that not even Microsoft Technical Writers are aware of that
> > patch:
> > Keith Brown published:
> > Bear in mind that you can use reflection to read these attributes
> > ("relative
> > to PrincipalPermissionAttribute") from an assembly. This should make it
> > easy
> > to generate documentation for your classes, including which roles are
> > allowed access to which classes and methods. This is another good reason
> > to
> > prefer using declarative checks over imperative checks wherever
> > possible...
> > MSDN Magazine > January 2002 > SECURITY BRIEFS | Managed Security
> > in
> > ASP.NET
> > http://msdn.microsoft.com/msdnmag/issues/02/01/security/
> > This undocumented peculiarity refers to "PrincipalPermissionAttribute"
> > only.
> > Or does it include a wider range of "Attribute-Morphos" framework
> > ?
> > Thanks,
> > alex
> > "Shawn Farkas [MS]" <email@example.com> wrote in message
> > news:O$cPz73NDHA.1556@TK2MSFTNGP10.phx.gbl...
> >> Hi Alex,
> >> Unfortunately, although they look like custom attributes when you
> > apply
> >> them, declarative security demands are not stored as custom attributes
> > an
> >> assembly. Therefore you won't be able to see them when you reflect
> > the
> >> custom security. In current releases of the framework, there is no way
> >> to
> >> use reflection to access declaritive security, although we are
> >> considering
> >> adding this feature to a future version.
> >> -Shawn