Bagikan melalui


PolicyStatement.PermissionSet Properti

Definisi

Perhatian

Code Access Security is not supported or honored by the runtime.

Mendapatkan atau menetapkan PermissionSet pernyataan kebijakan.

public:
 property System::Security::PermissionSet ^ PermissionSet { System::Security::PermissionSet ^ get(); void set(System::Security::PermissionSet ^ value); };
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public System.Security.PermissionSet PermissionSet { get; set; }
public System.Security.PermissionSet PermissionSet { get; set; }
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
member this.PermissionSet : System.Security.PermissionSet with get, set
member this.PermissionSet : System.Security.PermissionSet with get, set
Public Property PermissionSet As PermissionSet

Nilai Properti

Pernyataan PermissionSet kebijakan.

Atribut

Contoh

Contoh kode berikut menunjukkan cara menggunakan PermissionSet properti untuk menambahkan izin ke pernyataan kebijakan. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk PolicyStatement kelas .

NamedPermissionSet^ allPerms = gcnew NamedPermissionSet(
   L"allPerms" );
allPerms->AddPermission( gcnew SecurityPermission(
   SecurityPermissionFlag::Execution ) );
allPerms->AddPermission( gcnew ZoneIdentityPermission(
   SecurityZone::MyComputer ) );
allPerms->AddPermission( gcnew SiteIdentityPermission(
   L"www.contoso.com" ) );

( *policyStatement)->PermissionSet = allPerms;
NamedPermissionSet allPerms = new NamedPermissionSet("allPerms");
allPerms.AddPermission(
    new SecurityPermission(SecurityPermissionFlag.Execution));
allPerms.AddPermission(
    new ZoneIdentityPermission(SecurityZone.MyComputer));
allPerms.AddPermission(
    new SiteIdentityPermission("www.contoso.com"));

policyStatement.PermissionSet = allPerms;
Dim allPerms As New NamedPermissionSet("allPerms")
allPerms.AddPermission( _
    New SecurityPermission(SecurityPermissionFlag.Execution))
allPerms.AddPermission( _
    New ZoneIdentityPermission(SecurityZone.MyComputer))
allPerms.AddPermission( _
    New SiteIdentityPermission("www.contoso.com"))

policyStatement.PermissionSet = allPerms

Keterangan

Perhatian

Keamanan Akses Kode (CAS) tidak digunakan lagi di semua versi .NET Framework dan .NET. Versi terbaru .NET tidak mematuhi anotasi CAS dan menghasilkan kesalahan jika API terkait CAS digunakan. Pengembang harus mencari cara alternatif untuk menyelesaikan tugas keamanan.

Berlaku untuk