Attributes and Reflection
Does anybody know how to use reflection to obtain information about the standard attributes on a method, class, etc? There is MemberInfo.GetCustomAttributes, but as the name implies this only seems to work for you own custom attributes.
Specifically I'd like to apply a PrincipalPermission to a method of a business object so only users in a particular role can execute it. However, if this function is to be called in response to a button click for example, it would be nice for the UI to be able to pre-empt the potential security exception and grey-out the button when the user does not have sufficient privelege. I was hoping it could do this with reflection.