This documentation is archived and is not being maintained.

WebPermission Constructor (NetworkAccess, String)

.NET Framework 1.1

Initializes a new instance of the WebPermission class with the specified access rights for the specified URI.

[Visual Basic]
Public Sub New( _
   ByVal access As NetworkAccess, _
   ByVal uriString As String _
public WebPermission(
   NetworkAccess access,
 string uriString
public: WebPermission(
   NetworkAccess access,
 String* uriString
public function WebPermission(
   access : NetworkAccess,
 uriString : String


A NetworkAccess value indicating what kind of access to grant to the specified URI. Accept indicates that the application is allowed to accept connections from the Internet on a local resource. Connect indicates that the application is allowed to connect to specific Internet resources.
A URI string to which access rights are granted.


Exception Type Condition
ArgumentNullException uriString is a null reference (Nothing in Visual Basic).


This constructor initializes a WebPermission and grants its target permission to either make a remote host connection or to accept a remote host connection using the URI described by the uriString parameter.


[Visual Basic, C#, C++] The following example creates a new instance of WebPermission with connect rights for the specified URI.

[Visual Basic] 
' Create a WebPermission.instance.
Dim myWebPermission1 As New WebPermission(NetworkAccess.Connect, "")


    // Create a WebPermission.instance.
    WebPermission myWebPermission1 = new WebPermission(NetworkAccess.Connect,"");

// Create a WebPermission::instance.
WebPermission* myWebPermission1 = new WebPermission(NetworkAccess::Connect, S"");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


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

WebPermission Class | WebPermission Members | System.Net Namespace | WebPermission Constructor Overload List | Regex