|
|||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||
|
Announcements
Chapters
Services
Feature Zones
|
Note: This is an unedited contribution. If this article is inappropriate,
needs attention or copies someone else's work without reference then please
Report This Article
Permissions View Tool (Permview.exe .Net FrameWork Tools Series)Permissions View Tool is shipped with .Net FrameWork. This tool is used to view the Declarative and Requested permissions set on an assembly. 8) Run the application. The form will not be loaded instead you will see the below error message: minimal permission set: <PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Write="c:\"/> </PermissionSet> optional permission set: Not specified refused permission set: <PermissionSet class="System.Security.PermissionSet" version="1"> <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1"Window="AllWindows"/> </PermissionSet> 13) Since we have set RequestRefuse permission for UIPermission we were unable to see the form so let us change that to RequestOptional as follows :[assembly: UIPermission(SecurityAction.RequestOptional, Window = UIPermissionWindow.AllWindows)]These permissions on the assesmbly that we saw were erquested permissions on the assembly. Permview is also used to view declarative security on classes or methods. 14) Let us add Declarative security to our MyClass as follows: 18) You will see the class declarative permissions (as shown below) along with the requested assembly permissions. <PermissionSet class="System.Security.PermissionSet" version="1"> <Permission class="System.Security.Permissions.PrincipalPermission, mscorlib, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1"> <Identity Authenticated="true" ID="mycomputer\Administrator"/> </Permission> </PermissionSet> 19) You will be able to execute the method call if the current user is an Administrator on the machine. In this way we can use Permview.exe to view the declarative and requested permissions set on any assembly. There are 3 types of requested permissions which can be granted on assembly : Minimum permissions: (RequestMinimum) Permissions your code must have in order to run. Optional permissions: (RequestOptional) Permissions your code can use, but can run effectively without. Refused permissions: (RequestRefuse) Permissions that you want to ensure will never be granted to your code, even if security policy allows them to be granted.
|
||||||||||||||||||||||||||||||||||||||||