The Permissions View tool (Permview.exe) allows you
to view the
declarative security statements used in an assembly. This is
particularly useful when configuring security policy, as it allows
you to view the permission requests contained in the assembly.
Permview.exe is located in the
\bin subdirectory of the .NET
Framework SDK installation directory. Note that the \bin directory is not added to the
Path environment variable by the SDK-installation
Permview.exe only shows declarative security statements and cannot extract the imperative security demands. It overrides from the body of an assembly.
To demonstrate Permview.exe, use
shown here, which allows any caller to
display a message box containing the value of the
Message environment variable.
MessageUtil uses three
RequestMinumum permission requests to ensure that
it has permission to read the
Assert, and display safe
top-level windows (such as message boxes). The
DisplayMessage method uses declarative syntax to
EnvironmentPermission. This allows any client code
DisplayMessage regardless of the
# C# using System; using System.Windows.Forms; using System.Security.Permissions; // Request read access to the Message environment variable. [assembly:EnvironmentPermission(SecurityAction.RequestMinimum, Read = "Message")] // Request permission to Assert. [assembly:SecurityPermission(SecurityAction.RequestMinimum, ...