SiteIdentityPermissionAttribute クラス
アセンブリ: mscorlib (mscorlib.dll 内)
構文
<SerializableAttribute> _ <ComVisibleAttribute(True)> _ <AttributeUsageAttribute(AttributeTargets.Assembly Or AttributeTargets.Class Or AttributeTargets.Struct Or AttributeTargets.Constructor Or AttributeTargets.Method, AllowMultiple:=True, Inherited:=False)> _ Public NotInheritable Class SiteIdentityPermissionAttribute Inherits CodeAccessSecurityAttribute
[SerializableAttribute] [ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false)] public sealed class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
[SerializableAttribute] [ComVisibleAttribute(true)] [AttributeUsageAttribute(AttributeTargets::Assembly|AttributeTargets::Class|AttributeTargets::Struct|AttributeTargets::Constructor|AttributeTargets::Method, AllowMultiple=true, Inherited=false)] public ref class SiteIdentityPermissionAttribute sealed : public CodeAccessSecurityAttribute
/** @attribute SerializableAttribute() */ /** @attribute ComVisibleAttribute(true) */ /** @attribute AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false) */ public final class SiteIdentityPermissionAttribute extends CodeAccessSecurityAttribute
SerializableAttribute ComVisibleAttribute(true) AttributeUsageAttribute(AttributeTargets.Assembly|AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Constructor|AttributeTargets.Method, AllowMultiple=true, Inherited=false) public final class SiteIdentityPermissionAttribute extends CodeAccessSecurityAttribute
サイト ID は、HTTP、HTTPS、および FTP のプロトコルの付いた URL からのコードだけで定義されます。URL のプロトコルの後ろの "//" から次の "/" までの間に文字列がある場合は、その文字列がサイトを表します。たとえば、URL http://www.fourthcoffee.com/process/grind.htm の www.fourthcoffee.com がサイトです。ポート番号は除外されます。URL が http://www.fourthcoffee.com:8000/ の場合、サイトは www.fourthcoffee.com:8000 ではなく www.fourthcoffee.com になります。
サイトには、完全に一致する文字列か、ドット区切り文字の前にワイルドカード ("*") を付けた文字列を指定できます。たとえば、サイト名として文字列 *.fourthcoffee.com を指定すると、fourthcoffee.com と www.fourthcoffee.com の両方と一致します。ワイルドカードを使用しない場合は、正確に一致するサイト名だけが見つかります。サイト名として文字列 * を指定した場合、任意のサイトと一致しますが、サイト証明のないコードとは一致しません。
宣言の許容スコープは、使用する SecurityAction によって異なります。
セキュリティ属性によって宣言されたセキュリティ情報は、属性ターゲットのメタデータに格納され、実行時にシステムによってアクセスされます。セキュリティ属性は宣言セキュリティにだけ使用されます。強制セキュリティの場合は、対応するアクセス許可クラスを使用します。
次の宣言属性の例では、SiteIdentityPermission を要求する正しい方法を示し、コードを実行するためには少なくともこのアクセス許可が必要であることを示します。コードは、example.microsoft.com などの Web サイトから実行する場合にだけ実行されます。
<Assembly: SiteIdentityPermissionAttribute(SecurityAction.RequestMinimum, _ Site := "example.microsoft.com")> 'In Visual Basic, you must specify that you are using the assembly scope when making a request.
[assembly:SiteIdentityPermissionAttribute(SecurityAction.RequestMinimum, Site="example.microsoft.com")] //In C#, you must specify that you are using the assembly scope when // making a request.
[assembly:SiteIdentityPermissionAttribute(SecurityAction::RequestMinimum, Site="example.microsoft.com")]; //In C++, you must specify that you are using the assembly scope when // making a request.
/** @assembly SiteIdentityPermissionAttribute(SecurityAction.RequestMinimum, Site = "example.microsoft.com") */ // In VJ#, you must specify that you are using the assembly scope when // making a request.
リンク時に呼び出し元コードに SiteIdentityPermission を要求する方法を次の例に示します。コードは、example.microsoft.com などの Web サイトから実行する場合にだけ実行されます。
System.Attribute
System.Security.Permissions.SecurityAttribute
System.Security.Permissions.CodeAccessSecurityAttribute
System.Security.Permissions.SiteIdentityPermissionAttribute
プラットフォーム
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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- SiteIdentityPermissionAttribute クラスのページへのリンク