DataProtectionPermission.FromXml(SecurityElement) Metoda

Definice

Rekonstruuje oprávnění s konkrétním stavem z kódování XML.

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)

Parametry

securityElement
SecurityElement

A SecurityElement , který obsahuje kódování XML použité k rekonstrukci oprávnění.

Výjimky

securityElement je null.

securityElement není platný prvek oprávnění.

-nebo-

Číslo verze není securityElement podporováno.

Příklady

Následující příklad kódu ukazuje použití FromXml metody . Tento příklad kódu je součástí většího příkladu DataProtectionPermission pro třídu .

Poznámka

Příklad kódu je určen k zobrazení chování metody, nikoli k demonstraci jejího použití. Obecně platí, že metody tříd oprávnění jsou používány infrastrukturou zabezpečení; v aplikacích se obvykle nepoužívají.

Console::WriteLine( "Using an XML round trip to reset the fourth "
"permission." );
sp4->FromXml( sp2->ToXml() );
rc = sp4->Equals( sp2 );
Console::WriteLine( "Does the XML round trip result equal the "
"original permission? {0}", (rc ? (String^)"Yes" : "No") );
Console.WriteLine("Using an XML round trip to reset the fourth " +
    "permission.");
sp4.FromXml(sp2.ToXml());
rc = sp4.Equals(sp2);
Console.WriteLine("Does the XML round trip result equal the " +
    "original permission? " + (rc ? "Yes" : "No"));
    Console.WriteLine("Using an XML round trip to reset the fourth " + "permission.")
    sp4.FromXml(sp2.ToXml())
    rc = sp4.Equals(sp2)
    Console.WriteLine("Does the XML round trip result equal the " + "original permission? " + IIf(rc, "Yes", "No")) 'TODO: For performance reasons this should be changed to nested IF statements

End Sub

Poznámky

Metoda FromXml rekonstruuje DataProtectionPermission objekt z kódování XML definovaného SecurityElement třídou . ToXml Pomocí metody XML kódujte DataProtectionPermission, včetně informací o stavu.

Platí pro