UrlIdentityPermission.ToXml メソッド
アセンブリ: mscorlib (mscorlib.dll 内)

Dim instance As UrlIdentityPermission Dim returnValue As SecurityElement returnValue = instance.ToXml
状態情報を含む、アクセス許可の XML エンコーディング。

' ToXml creates an XML encoding of the permission and its current state; FromXml ' reconstructs a permission with the specified state from the XML encoding. Private Function ToFromXmlDemo() As Boolean Dim returnValue As Boolean = True Dim url1 As String = "" Dim urlIdPerm1, urlIdPerm2 As UrlIdentityPermission Dim urlGen1 As New UrlGenerator() Dim urlGen2 As New UrlGenerator() urlGen1.ResetIndex() While urlGen1.CreateUrl(url1) urlIdPerm1 = New UrlIdentityPermission(url1) Console.WriteLine("********************************************************\n") urlGen2.ResetIndex() Try urlIdPerm2 = New UrlIdentityPermission(PermissionState.None) urlIdPerm2.FromXml(urlIdPerm1.ToXml()) Console.WriteLine("Result of ToFromXml = " & urlIdPerm2.ToString()) Catch e As Exception Console.WriteLine("ToFromXml failed :" & urlIdPerm1.ToString() & e.ToString()) GoTo ContinueWhile1 End Try ContinueWhile1: End While Return returnValue End Function 'ToFromXmlDemo
// ToXml creates an XML encoding of the permission and its current state; FromXml // reconstructs a permission with the specified state from the XML encoding. private bool ToFromXmlDemo() { bool returnValue = true; string url1; UrlIdentityPermission urlIdPerm1, urlIdPerm2; UrlGenerator urlGen1 = new UrlGenerator(); UrlGenerator urlGen2 = new UrlGenerator(); urlGen1.ResetIndex(); while (urlGen1.CreateUrl(out url1)) { urlIdPerm1 = new UrlIdentityPermission(url1); Console.WriteLine("********************************************************\n"); urlGen2.ResetIndex(); try { urlIdPerm2 = new UrlIdentityPermission(PermissionState.None); urlIdPerm2.FromXml(urlIdPerm1.ToXml()); Console.WriteLine("Result of ToFromXml = " + urlIdPerm2.ToString() + "\n"); } catch (Exception e) { Console.WriteLine("ToFromXml failed :" + urlIdPerm1.ToString() + e); continue; } } return returnValue; }
// ToXml creates an XML encoding of the permission and // its current state; FromXml // reconstructs a permission with the specified state from // the XML encoding. private boolean ToFromXmlDemo() { boolean returnValue = true; String url1[] = new String[1]; UrlIdentityPermission urlIdPerm1[] = new UrlIdentityPermission[1]; UrlIdentityPermission urlIdPerm2[] = new UrlIdentityPermission[1]; UrlGenerator urlGen1 = new UrlGenerator(); UrlGenerator urlGen2 = new UrlGenerator(); urlGen1.ResetIndex(); while (urlGen1.CreateUrl(urlIdPerm1, url1)) { if (urlIdPerm1 == null) { continue; } Console.WriteLine("********************************************" + "************\n"); urlGen2.ResetIndex(); try { urlIdPerm2[0] = new UrlIdentityPermission(PermissionState.None); urlIdPerm2[0].FromXml(urlIdPerm1[0].ToXml()); Console.WriteLine(("Result of ToFromXml = " + urlIdPerm2[0].ToString() + "\n")); } catch (System.Exception e) { Console.WriteLine(("ToFromXml failed :" + urlIdPerm1.ToString() + e)); continue; } } return returnValue; } //ToFromXmlDemo

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- UrlIdentityPermission.ToXml メソッドのページへのリンク