WebPermission とその現在の状態を表す XML エンコーディングを作成します。
Overrides Public Function ToXml() As SecurityElement Implements _ ISecurityEncodable.ToXml
[C#]
public override SecurityElement ToXml();
[C++]
public: SecurityElement* ToXml();
[JScript]
public override function ToXml() : SecurityElement;
戻り値
ステータス情報を含む WebPermission の XML エンコードされた表現を格納する SecurityElement 。
実装
解説
FromXml メソッドを使用して、 SecurityElement のステータス情報を復元します。
使用例
[Visual Basic, C#, C++] ToXml を使用して System.Security.SecurityElement を作成し、その属性をコンソールに表示する方法の例を次に示します。
' 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())
[C#]
// 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());
[C++]
// 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(S"Attributes and Values of the WebPermission are :");
myWebPermission1->ToXml();
// 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());
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ, Common Language Infrastructure (CLI) Standard
参照
WebPermission クラス | WebPermission メンバ | System.Net 名前空間 | FromXml