This documentation is archived and is not being maintained.

SocketPermissionAttribute.CreatePermission Method

Creates and returns a new instance of the SocketPermission class.

[Visual Basic]
Overrides Public Function CreatePermission() As IPermission
public override IPermission CreatePermission();
public: IPermission* CreatePermission();
public override function CreatePermission() : IPermission;

Return Value

An instance of the SocketPermission class corresponding to the security declaration.


Exception Type Condition
ArgumentException One or more of the current instance's Access, Host, Transport, or Port properties is a null reference (Nothing in Visual Basic).


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


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

SocketPermissionAttribute Class | SocketPermissionAttribute Members | System.Net Namespace | SocketPermission