다음을 통해 공유


WebPermission.FromXml(SecurityElement) 메서드

정의

XML 인코딩에서 WebPermission을 다시 만듭니다.

public:
 override void FromXml(System::Security::SecurityElement ^ securityElement);
public override void FromXml (System.Security.SecurityElement securityElement);
override this.FromXml : System.Security.SecurityElement -> unit
Public Overrides Sub FromXml (securityElement As SecurityElement)

매개 변수

securityElement
SecurityElement

WebPermission을 다시 만드는 데 사용되는 XML 인코딩입니다.

예외

securityElement 매개 변수가 null인 경우

securityElement가 이 형식에 대한 사용 권한 요소가 아닌 경우

예제

다음 예제에서는 을 System.Security.SecurityElement만들고 특성을 채우고 를 사용하여 FromXml 이 정보를 인스턴스 WebPermission로 전송합니다.

// Create  a WebPermission without permission on the protected resource
WebPermission^ myWebPermission1 = gcnew WebPermission( PermissionState::None );

// Create a SecurityElement by calling the ToXml method on the WebPermission
// instance and display its attributes (which hold the XML encoding of
// the WebPermission).
Console::WriteLine( "Attributes and Values of the WebPermission are:" );
myWebPermission1->ToXml();

// Create another WebPermission with no permission on the protected resource
WebPermission^ myWebPermission2 = gcnew WebPermission( PermissionState::None );

//Converts the new WebPermission from XML using myWebPermission1.
myWebPermission2->FromXml( myWebPermission1->ToXml() );

// Create  a WebPermission without permission on the protected resource.
WebPermission myWebPermission1 = new WebPermission(PermissionState.None);

// Create a SecurityElement by calling the ToXml method on the WebPermission 
// instance and display its attributes (which hold the XML encoding of 
// the WebPermission).
Console.WriteLine("Attributes and Values of the WebPermission are :");
myWebPermission1.ToXml().ToString();

// Create another WebPermission with no permission on the protected resource.
WebPermission myWebPermission2 = new WebPermission(PermissionState.None);

//Converts the new WebPermission from XML using myWebPermission1.
myWebPermission2.FromXml(myWebPermission1.ToXml());
' Create  a WebPermission without permission on the protected resource.
Dim myWebPermission1 As New WebPermission(PermissionState.None)

' Create a SecurityElement by calling the ToXml method on the WebPermission 
' instance and display its attributes (which hold the XML encoding of 
' the WebPermission).
Console.WriteLine("Attributes and Values of the WebPermission are :")
myWebPermission1.ToXml().ToString()

' Create another WebPermission with no permission on the protected resource.
Dim myWebPermission2 As New WebPermission(PermissionState.None)

'Converts the new WebPermission from XML using myWebPermission1.
myWebPermission2.FromXml(myWebPermission1.ToXml())

설명

메서드는 FromXml 클래스에 의해 SecurityElement 정의 된 XML 인코딩에서 를 다시 구성 WebPermission 합니다.

메서드를 ToXml 사용하여 상태 정보를 포함하여 를 XML로 인코딩 WebPermission합니다.

적용 대상

추가 정보