DnsPermissionAttribute クラス
アセンブリ: System (system.dll 内)

<SerializableAttribute> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Constructor Or AttributeTargets.Method, AllowMultiple:=True, Inherited:=False)> _ Public NotInheritable Class DnsPermissionAttribute Inherits CodeAccessSecurityAttribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false)] public sealed class DnsPermissionAttribute : CodeAccessSecurityAttribute
[SerializableAttribute] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Constructor|AttributeTargets::Method, AllowMultiple=true, Inherited=false)] public ref class DnsPermissionAttribute sealed : public CodeAccessSecurityAttribute
/** @attribute SerializableAttribute() */ /** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false) */ public final class DnsPermissionAttribute extends CodeAccessSecurityAttribute

DnsPermissionAttribute によって宣言されたセキュリティ情報は、DnsPermissionAttribute が適用されるクラスである属性ターゲットのメタデータに格納されます。その後、システムは、実行時にこの情報にアクセスします。コンストラクタに渡される SecurityAction により、許容される DNS ターゲットが決まります。
これらのセキュリティ属性は、宣言セキュリティ にだけ使用されます。強制セキュリティ に対しては、対応する DnsPermission クラスを使用します。
セキュリティ アクセスは、完全に制限されるか、完全に無制限かのいずれかです。アクセスを許可するには、Unrestricted プロパティを true に設定し、アクセスを許可しない場合は false に設定します。このプロパティを名前付きパラメータとして設定します。

DnsPermissionAttribute を使用して、宣言セキュリティをカスタム クラスに適用する例を次に示します。
' Uses the DnsPermissionAttribute to restrict access only to those who have permission. <DnsPermission(SecurityAction.Demand, Unrestricted := true)> _ Public Class MyClass1 Public Shared Function GetIPAddress() As IPAddress Dim ipAddress As IPAddress = Dns.Resolve("localhost").AddressList(0) Return ipAddress End Function 'GetIPAddress Public Shared Sub Main() Try ' Grants Access. Console.WriteLine(("Access granted" + ControlChars.NewLine + " The local host IP Address is :" + MyClass1.GetIPAddress().ToString())) ' Denies Access. Catch securityException As SecurityException Console.WriteLine("Access denied") Console.WriteLine(securityException.ToString()) End Try
//Uses the DnsPermissionAttribute to restrict access only to those who have permission. [DnsPermission(SecurityAction.Demand, Unrestricted = true)] public class MyClass{ public static IPAddress GetIPAddress(){ IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0]; return ipAddress; } public static void Main(){ try{ //Grants Access. Console.WriteLine(" Access granted\n The local host IP Address is :" + MyClass.GetIPAddress().ToString()); } // Denies Access. catch(SecurityException securityException){ Console.WriteLine("Access denied"); Console.WriteLine(securityException.ToString()); }
//Uses the DnsPermissionAttribute to restrict access only to those who have permission. [DnsPermission(SecurityAction::Demand,Unrestricted=true)] public ref class MyClass { public: static IPAddress^ GetIPAddress() { IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; return ipAddress; } }; int main() { try { //Grants Access. Console::WriteLine( " Access granted\n The local host IP Address is :{0}", MyClass::GetIPAddress() ); } // Denies Access. catch ( SecurityException^ securityException ) { Console::WriteLine( "Access denied" ); Console::WriteLine( securityException->ToString() ); } }
// Uses the DnsPermissionAttribute to restrict access only to those who // have permission. /** @attribute DnsPermission(SecurityAction.Demand, Unrestricted = true) */ public class MyClass { public static IPAddress GetIPAddress() { IPAddress ipAddress = (IPAddress)Dns.Resolve( "localhost").get_AddressList().get_Item(0); return ipAddress; } //GetIPAddress public static void main(String[] args) { try { //Grants Access. Console.WriteLine(" Access granted\n The local host IP " + "Address is :" + MyClass.GetIPAddress().ToString()); } // Denies Access. catch (System.Security.SecurityException securityException) { Console.WriteLine("Access denied"); Console.WriteLine(securityException.ToString()); } } //main } //MyClass

System.Attribute
System.Security.Permissions.SecurityAttribute
System.Security.Permissions.CodeAccessSecurityAttribute
System.Net.DnsPermissionAttribute


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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DnsPermissionAttribute コンストラクタ
アセンブリ: System (system.dll 内)




DnsPermissionAttribute を使用して、宣言セキュリティをカスタム クラスに適用する例を次に示します。
' Uses the DnsPermissionAttribute to restrict access only to those who have permission. <DnsPermission(SecurityAction.Demand, Unrestricted := true)> _ Public Class MyClass1 Public Shared Function GetIPAddress() As IPAddress Dim ipAddress As IPAddress = Dns.Resolve("localhost").AddressList(0) Return ipAddress End Function 'GetIPAddress Public Shared Sub Main() Try ' Grants Access. Console.WriteLine(("Access granted" + ControlChars.NewLine + " The local host IP Address is :" + MyClass1.GetIPAddress().ToString())) ' Denies Access. Catch securityException As SecurityException Console.WriteLine("Access denied") Console.WriteLine(securityException.ToString()) End Try
//Uses the DnsPermissionAttribute to restrict access only to those who have permission. [DnsPermission(SecurityAction.Demand, Unrestricted = true)] public class MyClass{ public static IPAddress GetIPAddress(){ IPAddress ipAddress = Dns.Resolve("localhost").AddressList[0]; return ipAddress; } public static void Main(){ try{ //Grants Access. Console.WriteLine(" Access granted\n The local host IP Address is :" + MyClass.GetIPAddress().ToString()); } // Denies Access. catch(SecurityException securityException){ Console.WriteLine("Access denied"); Console.WriteLine(securityException.ToString()); }
//Uses the DnsPermissionAttribute to restrict access only to those who have permission. [DnsPermission(SecurityAction::Demand,Unrestricted=true)] public ref class MyClass { public: static IPAddress^ GetIPAddress() { IPAddress^ ipAddress = Dns::Resolve( "localhost" )->AddressList[ 0 ]; return ipAddress; } }; int main() { try { //Grants Access. Console::WriteLine( " Access granted\n The local host IP Address is :{0}", MyClass::GetIPAddress() ); } // Denies Access. catch ( SecurityException^ securityException ) { Console::WriteLine( "Access denied" ); Console::WriteLine( securityException->ToString() ); } }
// Uses the DnsPermissionAttribute to restrict access only to those who // have permission. /** @attribute DnsPermission(SecurityAction.Demand, Unrestricted = true) */ public class MyClass { public static IPAddress GetIPAddress() { IPAddress ipAddress = (IPAddress)Dns.Resolve( "localhost").get_AddressList().get_Item(0); return ipAddress; } //GetIPAddress public static void main(String[] args) { try { //Grants Access. Console.WriteLine(" Access granted\n The local host IP " + "Address is :" + MyClass.GetIPAddress().ToString()); } // Denies Access. catch (System.Security.SecurityException securityException) { Console.WriteLine("Access denied"); Console.WriteLine(securityException.ToString()); } } //main } //MyClass

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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


DnsPermissionAttribute プロパティ

名前 | 説明 | |
---|---|---|
![]() | Action | セキュリティ アクションを取得または設定します。 ( SecurityAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。 ( Attribute から継承されます。) |
![]() | Unrestricted | 属性によって保護されているリソースに対して完全な (無制限の) アクセス許可が宣言されているかどうかを示す値を取得または設定します。 ( SecurityAttribute から継承されます。) |

DnsPermissionAttribute メソッド

名前 | 説明 | |
---|---|---|
![]() | CreatePermission | オーバーライドされます。 DnsPermission クラスの新しいインスタンスを作成して返します。 |
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 ( Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 ( Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 ( Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 ( Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 ( Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 ( Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 ( Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 ( Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 ( Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 ( Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 ( Object から継承されます。) |

DnsPermissionAttribute メンバ
ドメイン ネーム サーバーの情報を要求するためのアクセス許可を指定します。
DnsPermissionAttribute データ型で公開されるメンバを以下の表に示します。

名前 | 説明 | |
---|---|---|
![]() | DnsPermissionAttribute | 指定した SecurityAction 値を使用して、DnsPermissionAttribute クラスの新しいインスタンスを初期化します。 |

名前 | 説明 | |
---|---|---|
![]() | Action | セキュリティ アクションを取得または設定します。(SecurityAttribute から継承されます。) |
![]() | TypeId | 派生クラスに実装されている場合は、この Attribute の一意の識別子を取得します。(Attribute から継承されます。) |
![]() | Unrestricted | 属性によって保護されているリソースに対して完全な (無制限の) アクセス許可が宣言されているかどうかを示す値を取得または設定します。(SecurityAttribute から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | CreatePermission | オーバーライドされます。 DnsPermission クラスの新しいインスタンスを作成して返します。 |
![]() | Equals | オーバーロードされます。 ( Attribute から継承されます。) |
![]() | GetCustomAttribute | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用された指定した型のカスタム属性を取得します。 (Attribute から継承されます。) |
![]() | GetCustomAttributes | オーバーロードされます。 アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されたカスタム属性の配列を取得します。 (Attribute から継承されます。) |
![]() | GetHashCode | このインスタンスのハッシュ コードを返します。 (Attribute から継承されます。) |
![]() | GetType | 現在のインスタンスの Type を取得します。 (Object から継承されます。) |
![]() | IsDefaultAttribute | 派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラスの既定値かどうかを示します。 (Attribute から継承されます。) |
![]() | IsDefined | オーバーロードされます。 指定した型のカスタム属性が、アセンブリ、モジュール、型のメンバ、またはメソッド パラメータに適用されているかどうかを判断します。 (Attribute から継承されます。) |
![]() | Match | 派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンスが等しいかどうかを示す値を返します。 (Attribute から継承されます。) |
![]() | ReferenceEquals | 指定した複数の Object インスタンスが同一かどうかを判断します。 (Object から継承されます。) |
![]() | ToString | 現在の Object を表す String を返します。 (Object から継承されます。) |

名前 | 説明 | |
---|---|---|
![]() | Finalize | Object がガベージ コレクションにより収集される前に、その Object がリソースを解放し、その他のクリーンアップ操作を実行できるようにします。 (Object から継承されます。) |
![]() | MemberwiseClone | 現在の Object の簡易コピーを作成します。 (Object から継承されます。) |

- DnsPermissionAttributeのページへのリンク