System.Net.WebPermissionAttribute Class

Specifies permission to access Internet resources. This class cannot be inherited.

See Also: WebPermissionAttribute Members


[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Struct | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.All, AllowMultiple=true, Inherited=false)]
public sealed class WebPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute


System.Net.WebPermissionAttribute allows you to declaratively specify which URI strings and regular expression strings your class can use.

The security information specified in the System.Net.WebPermissionAttribute is stored in the metadata of the attribute target, which is the class to which System.Net.WebPermissionAttribute is applied. The system accesses this information at run time. The System.Security.Permissions.SecurityAction passed to the constructor determines the allowable System.Net.WebPermissionAttribute targets. The system uses the System.Net.WebPermission returned by the WebPermissionAttribute.CreatePermission method to convert the security information of the attribute target to a serializable form stored in metadata.


System.Net.WebPermissionAttribute is used only for [<topic://cpcondeclarativesecurity>]. For [<topic://cpconimperativesecurity>], use the corresponding System.Net.WebPermission.

Thread Safety

All public static members of this type are safe for multithreaded operations. No instance members are guaranteed to be thread safe.


Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.x.x, 1.0.5000.0,,