This documentation is archived and is not being maintained.

WebPermission Constructor

.NET Framework 1.1

Creates a new instance of the WebPermission class.

Overload List

Creates a new instance of the WebPermission class.

[Visual Basic] Public Sub New()
[C#] public WebPermission();
[C++] public: WebPermission();
[JScript] public function WebPermission();

Creates a new instance of the WebPermission class that passes all demands or fails all demands.

[Visual Basic] Public Sub New(PermissionState)
[C#] public WebPermission(PermissionState);
[C++] public: WebPermission(PermissionState);
[JScript] public function WebPermission(PermissionState);

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

[Visual Basic] Public Sub New(NetworkAccess, Regex)
[C#] public WebPermission(NetworkAccess, Regex);
[C++] public: WebPermission(NetworkAccess, Regex*);
[JScript] public function WebPermission(NetworkAccess, Regex);

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

[Visual Basic] Public Sub New(NetworkAccess, String)
[C#] public WebPermission(NetworkAccess, string);
[C++] public: WebPermission(NetworkAccess, String*);
[JScript] public function WebPermission(NetworkAccess, String);

Example

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

[Visual Basic, C#, C++] Note   This example shows how to use one of the overloaded versions of the WebPermission constructor. For other examples that might be available, see the individual overload topics.
[Visual Basic] 
' Create a WebPermission.instance.
Dim myWebPermission1 As New WebPermission(NetworkAccess.Connect, "http://www.contoso.com/default.htm")
myWebPermission1.Demand()


[C#] 

    // Create a WebPermission.instance.
    WebPermission myWebPermission1 = new WebPermission(NetworkAccess.Connect,"http://www.contoso.com/default.htm");
    myWebPermission1.Demand();


[C++] 
// Create a WebPermission::instance.
WebPermission* myWebPermission1 = new WebPermission(NetworkAccess::Connect, S"http://www.contoso.com/default.htm");
myWebPermission1->Demand();

[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.

See Also

WebPermission Class | WebPermission Members | System.Net Namespace

Show: