Hi,
How can I check and make sure that a class uses my own custom security attribute? I know that I can use reflection to get normal attributes, but if the custom attribute is based on a security attribute as shown below reflection doesn't show it. Is there any way to check that?
Why I would need this is to make sure that a plugin that is loaded to a cloud based system must use security attribute so the class that get's loaded cannot access any restricted files and so on.
Here is the custom security class I'm using:
public class PluginSection : CodeAccessSecurityAttribute
{
public PluginSection(SecurityAction action)
: base(action)
{
}
public override IPermission CreatePermission()
{
// WebSites.GetInstance().LocalBaseDir returns the base directory where the class has accesss to login
return new FileIOPermission(FileIOPermissionAccess.Write, WebSites.GetInstance().LocalBaseDir);
}
}
I must use a class based on CodeAccessSecurityAttribute so that the FileIOPermission would work.
Also if there is another way to restrict the access of the plugin being loaded I could use that too.