
AspNetHostingPermissionAttribute | 483
System.Web
Namespace
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
Hierarchy
System.Object ➝ System.Security.CodeAccessPermission(System.Security.IPermission,
System.Security.ISecurityEncodable, System.Security.IStackWalk)
➝ AspNetHostingPermis-
sion(System.Security.Permissions.IUnrestrictedPermission)
AspNetHostingPermissionAttribute
System.Web (system.dll)
.NET 1.1, serializable
sealed class
With this attribute, you can ensure that the current assembly has the required code
access security permission to host the ASP.NET engine. If it does not, a System.Security.
SecurityException will be thrown immediately (which prevents the problem of an unex-
pected security-related failure later on). This attribute serves the same purpose as the
AspNetHostingPermission class. The difference is that while AspNetHostingPermission must be used
programmatically (by creating an instance and invoking the corresponding method),
AspNetHostingPermissionAttribute is used declaratively, by adding the attribute to an assembly
or code construct like a class or method declaration.
Note that this type only pertains to code access security (the policy of allowed and
disallowed actions configured using the .NET Framework Configuration Tool or the
caspol.exe command-line utility). It has nothing to do with ASP.NET or IIS