System.Net.SocketPermissionAttribute.CreatePermission Method

Creates and returns a new instance of the System.Net.SocketPermission class.

Syntax

public override System.Security.IPermission CreatePermission ()

Returns

An instance of the System.Net.SocketPermission class that corresponds to the security declaration.

Exceptions

TypeReason
ArgumentExceptionOne or more of the current instance's SocketPermissionAttribute.Access, SocketPermissionAttribute.Host, SocketPermissionAttribute.Transport or SocketPermissionAttribute.Port properties is null.

Remarks

The SocketPermissionAttribute.CreatePermission method is called by the security system, not by the application code. The security information described by System.Net.SocketPermissionAttribute is stored in the metadata of the attribute target, which is the class to which the System.Net.SocketPermissionAttribute is applied. The system then accesses the information at run-time and calls SocketPermissionAttribute.CreatePermission. The system uses the returned System.Security.IPermission to enforce the specified security requirements.

Requirements

Namespace: System.Net
Assembly: System (in System.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0