11.07.2015 Views

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

Improving Web Application Security: Threats and - CGISecurity

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 9: Using Code Access <strong>Security</strong> with ASP.NET 229(continued)...Continued list of permissions...Notice that each permission is defined by an element, which definesthe permission type name, version, <strong>and</strong> whether or not it is in the unrestricted state.Permission State <strong>and</strong> Unrestricted PermissionsMany permissions include state, which is used to fine-tune the access rights specifiedby the permission. The state determines precisely what the permission allows yourapplication to do. For example, a FileIOPermission might specify a directory <strong>and</strong> anaccess type (read, write, <strong>and</strong> so on). The following permission dem<strong>and</strong> requires thatcalling code is granted read permission to access the C:\SomeDir directory:(new FileIOPermission(FileIOPermissionAccess.Read, @"C:\SomeDir")).Dem<strong>and</strong>();In its unrestricted state, the FileIOPermission allows any type of access to any areaon the file system (of course, operating system security still applies). The followingpermission dem<strong>and</strong> requires that the calling code be granted the unrestrictedFileIOPermission:(new FileIOPermission(PermissionState.Unrestricted)).Dem<strong>and</strong>();The ASP.NET Named Permission SetASP.NET policy files contain an “ASP.NET” named permission set. This defines theset of permissions that is granted by application domain policy to associatedapplications.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!