Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

WebPermission.Copy Method

Creates a copy of a WebPermission.

[Visual Basic]
Overrides Public Function Copy() As IPermission Implements _
   IPermission.Copy
[C#]
public override IPermission Copy();
[C++]
public: IPermission* Copy();
[JScript]
public override function Copy() : IPermission;

Return Value

A new instance of the WebPermission class that has the same values as the original

Implements

IPermission.Copy

Remarks

The IPermission returned by this method represents the same access to resources as the original WebPermission. This method overrides Copy and is implemented to support the IPermission interface.

Example

[Visual Basic, C#, C++] The following example demonstrates how to create a second instance of WebPermission using Copy. This second instance is identical to the first.

[Visual Basic] 
' Create another WebPermission instance that is the copy of the above WebPermission instance.
Dim myWebPermission2 As WebPermission = CType(myWebPermission1.Copy(), WebPermission)

' Check whether all callers higher in the call stack have been granted the permissionor not.
myWebPermission2.Demand()


[C#] 
// Create another WebPermission instance that is the copy of the above WebPermission instance.
 WebPermission myWebPermission2 = (WebPermission) myWebPermission1.Copy();

// Check whether all callers higher in the call stack have been granted the permissionor not.
myWebPermission2.Demand();
   

[C++] 
// Create another WebPermission instance that is the copy of the above WebPermission instance.
WebPermission* myWebPermission2 = dynamic_cast<WebPermission*> (myWebPermission1->Copy());

// Check whether all callers higher in the call stack have been granted the permissionor not.
myWebPermission2->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.

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

WebPermission Class | WebPermission Members | System.Net Namespace

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft