SiteIdentityPermissionAttribute クラス
宣言セキュリティを使用して、 SiteIdentityPermission のセキュリティ アクションをコードに適用できるようにします。このクラスは継承できません。
この型のすべてのメンバの一覧については、SiteIdentityPermissionAttribute メンバ を参照してください。
System.Object
System.Attribute
System.Security.Permissions.SecurityAttribute
System.Security.Permissions.CodeAccessSecurityAttribute
System.Security.Permissions.SiteIdentityPermissionAttribute
<AttributeUsage(AttributeTargets.Assembly Or AttributeTargets.Class _
Or AttributeTargets.Struct Or AttributeTargets.Constructor Or _
AttributeTargets.Method)>
<Serializable>
NotInheritable Public Class SiteIdentityPermissionAttribute Inherits CodeAccessSecurityAttribute
[C#]
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class
| AttributeTargets.Struct | AttributeTargets.Constructor |
AttributeTargets.Method)]
[Serializable]
public sealed class SiteIdentityPermissionAttribute : CodeAccessSecurityAttribute
[C++]
[AttributeUsage(AttributeTargets::Assembly |
AttributeTargets::Class | AttributeTargets::Struct |
AttributeTargets::Constructor | AttributeTargets::Method)]
[Serializable]
public __gc __sealed class SiteIdentityPermissionAttribute : public CodeAccessSecurityAttribute
[JScript]
public
AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Class |
AttributeTargets.Struct | AttributeTargets.Constructor |
AttributeTargets.Method)
Serializable
class SiteIdentityPermissionAttribute extends CodeAccessSecurityAttribute
スレッドセーフ
この型の public static (Visual Basicでは Shared) のすべてのメンバは、マルチスレッド操作で安全に使用できます。インスタンスのメンバの場合は、スレッドセーフであるとは限りません。
解説
サイト ID は、HTTP、HTTPS、および FTP のプロトコルの付いた URL からのコードだけで定義されます。URL のプロトコルの後ろの "//" から次の "/" までの間に文字列がある場合は、その文字列がサイトを表します。たとえば、URL https://www.fourthcoffee.com/process/grind.htm の www.fourthcoffee.com がサイトです。ポート番号は除外されます。URL が https://www.fourthcoffee.com:8000/ の場合、サイトは www.fourthcoffee.com:8000 ではなく www.fourthcoffee.com になります。
サイトには、完全に一致する文字列か、ドット区切り文字の前にワイルドカード ("*") を付けた文字列を指定できます。たとえば、サイト名として文字列 *.fourthcoffee.com を指定すると、fourthcoffee.com と www.fourthcoffee.com の両方と一致します。ワイルドカードを使用しない場合は、正確に一致するサイト名だけが見つかります。サイト名として文字列 * を指定した場合、任意のサイトと一致しますが、サイト証明のないコードとは一致しません。
宣言の許容スコープは、使用する SecurityAction によって異なります。
セキュリティ属性によって宣言されたセキュリティ情報は、属性ターゲットのメタデータに格納され、実行時にシステムによってアクセスされます。セキュリティ属性は宣言セキュリティにだけ使用されます。強制セキュリティの場合は、対応するアクセス許可クラスを使用します。
使用例
[Visual Basic, C#, C++] 次の宣言属性の例では、 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.
[C#]
[assembly:SiteIdentityPermissionAttribute(SecurityAction.RequestMinimum,
Site="example.microsoft.com")]
//In C#, you must specify that you are using the assembly scope when
// making a request.
[C++]
[assembly:SiteIdentityPermissionAttribute(SecurityAction::RequestMinimum,
Site=S"example.microsoft.com")];
//In C++, you must specify that you are using the assembly scope when
// making a request.
[Visual Basic, C#, C++] リンク時に呼び出し元コードに SiteIdentityPermission を要求する方法を次の例に示します。コードは、example.microsoft.com などの Web サイトから実行する場合にだけ実行されます。
<SiteIdentityPermissionAttribute(SecurityAction.Demand, _
Site := "example.microsoft.com")> Public Class SampleClass
[C#]
[SiteIdentityPermissionAttribute(SecurityAction.Demand,
Site="example.microsoft.com")]
[C++]
[SiteIdentityPermissionAttribute(SecurityAction::Demand,
Site=S"example.microsoft.com")]
[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン をクリックします。
必要条件
名前空間: System.Security.Permissions
プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ
アセンブリ: Mscorlib (Mscorlib.dll 内)
参照
SiteIdentityPermissionAttribute メンバ | System.Security.Permissions 名前空間 | 属性を使用したメタデータの拡張 | SiteIdentityPermission | Site | SiteMembershipCondition