System.Net.WebPermissionAttribute Class

public sealed class WebPermissionAttribute : CodeAccessSecurityAttribute

Base Types

Object
  Attribute
    SecurityAttribute
      CodeAccessSecurityAttribute
        WebPermissionAttribute

Assembly

System

Library

Networking

Summary

Used to declaratively specify permission to access Internet resources.

Description

[Note: The security information declared by a security attribute is stored in the metadata of the attribute target, and is accessed by the system at run-time. Security attributes are used for declarative security only. For imperative security, use the corresponding permission class, WebPermission .

The allowable WebPermissionAttribute targets are determined by the SecurityAction passed to the constructor.

]

Attributes

AttributeUsageAttribute(AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Constructor | AttributeTargets.Method, AllowMultiple=true, Inherited=false)

See Also

System.Net Namespace

Members

WebPermissionAttribute Constructors

WebPermissionAttribute Constructor

WebPermissionAttribute Methods

WebPermissionAttribute.CreatePermission Method

WebPermissionAttribute Properties

WebPermissionAttribute.Accept Property
WebPermissionAttribute.Connect Property


WebPermissionAttribute Constructor

public WebPermissionAttribute(SecurityAction action);

Summary

Constructs a new instance of the WebPermissionAttribute class with the specified SecurityAction value.

Parameters

action
A SecurityAction value.

Exceptions

Exception TypeCondition
ArgumentExceptionaction is not a valid SecurityAction value.

See Also

System.Net.WebPermissionAttribute Class, System.Net Namespace

WebPermissionAttribute.CreatePermission Method

public override IPermission CreatePermission();

Summary

Returns a WebPermission instance that contains the security information of the current instance.

Return Value

A WebPermission object with the security information of the current instance.

Description

[Note: Applications typically do not call this method; it is intended for use by the system.

The security information described by a security attribute is stored in the metadata of the attribute target, and is accessed by the system at run-time. The system uses the object returned by this method to convert the security information of the current instance into the form stored in metadata.

This method overrides System.Security.Permissions.SecurityAttribute.CreatePermission.

]

See Also

System.Net.WebPermissionAttribute Class, System.Net Namespace

WebPermissionAttribute.Accept Property

public string Accept { get; set; }

Summary

Gets or sets the URI accepted by the current instance.

Property Value

A String that represents the URI accepted by the current instance.

Exceptions

Exception TypeCondition
ArgumentExceptionSystem.Net.WebPermissionAttribute.Acceptis being set and is not null .

Description

This property is write-once. Once this property has been set to a non-null value, attempts to set this property to new value cause a ArgumentException .

See Also

System.Net.WebPermissionAttribute Class, System.Net Namespace

WebPermissionAttribute.Connect Property

public string Connect { get; set; }

Summary

Gets or sets the URI connection controlled by the current instance.

Property Value

A String that represents the connection controlled by the current instance.

Exceptions

Exception TypeCondition
ArgumentExceptionSystem.Net.WebPermissionAttribute.Connect is being set and is not null .

Description

This property is write-once. Once this property has been set to a non-null value, attempts to set this property to new value cause a ArgumentException .

See Also

System.Net.WebPermissionAttribute Class, System.Net Namespace