Share via


SocketPermissionAttribute Kelas

Definisi

Perhatian

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

Menentukan tindakan keamanan untuk mengontrol Socket koneksi. Kelas ini tidak dapat diwariskan.

public ref class SocketPermissionAttribute sealed : System::Security::Permissions::CodeAccessSecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
public sealed class SocketPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")]
public sealed class SocketPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
[System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)]
[System.Serializable]
public sealed class SocketPermissionAttribute : System.Security.Permissions.CodeAccessSecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
type SocketPermissionAttribute = class
    inherit CodeAccessSecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type SocketPermissionAttribute = class
    inherit CodeAccessSecurityAttribute
[<System.AttributeUsage(System.AttributeTargets.Assembly | System.AttributeTargets.Class | System.AttributeTargets.Constructor | System.AttributeTargets.Method | System.AttributeTargets.Struct, AllowMultiple=true, Inherited=false)>]
[<System.Serializable>]
type SocketPermissionAttribute = class
    inherit CodeAccessSecurityAttribute
Public NotInheritable Class SocketPermissionAttribute
Inherits CodeAccessSecurityAttribute
Warisan
Atribut

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.

Untuk menggunakan atribut ini, koneksi Anda Socket harus sesuai dengan properti yang ditentukan dalam Anda SocketPermissionAttribute. Misalnya, untuk menerapkan izin ke Socket koneksi pada port 80, atur Port properti dari SocketPermissionAttribute ke "80". Informasi keamanan yang ditentukan di SocketPermissionAttribute disimpan dalam metadata target atribut, yang merupakan kelas tempat SocketPermissionAttribute diterapkan. Sistem kemudian mengakses informasi pada durasi. SecurityAction yang diteruskan ke konstruktor menentukan target yang diizinkanSocketPermissionAttribute.

Catatan

Properti harus SocketPermissionAttribute memiliki nilai yang bukan null. Selain itu, setelah diatur, nilai properti tidak dapat diubah.

Catatan

Untuk informasi selengkapnya tentang menggunakan atribut, lihat Atribut.

Konstruktor

SocketPermissionAttribute(SecurityAction)
Kedaluwarsa.

Menginisialisasi instans SocketPermissionAttribute baru kelas dengan nilai yang ditentukan SecurityAction .

Properti

Access
Kedaluwarsa.

Mendapatkan atau mengatur metode akses jaringan yang diizinkan oleh ini SocketPermissionAttribute.

Action
Kedaluwarsa.

Mendapatkan atau mengatur tindakan keamanan.

(Diperoleh dari SecurityAttribute)
Host
Kedaluwarsa.

Mendapatkan atau mengatur nama host DNS atau alamat IP yang ditentukan oleh ini SocketPermissionAttribute.

Port
Kedaluwarsa.

Mendapatkan atau mengatur nomor port yang terkait dengan ini SocketPermissionAttribute.

Transport
Kedaluwarsa.

Mendapatkan atau mengatur TransportType yang ditentukan oleh ini SocketPermissionAttribute.

TypeId
Kedaluwarsa.

Ketika diimplementasikan di kelas turunan, mendapatkan pengidentifikasi unik untuk ini Attribute.

(Diperoleh dari Attribute)
Unrestricted
Kedaluwarsa.

Mendapatkan atau menetapkan nilai yang menunjukkan apakah izin penuh (tidak terbatas) ke sumber daya yang dilindungi oleh atribut dideklarasikan.

(Diperoleh dari SecurityAttribute)

Metode

CreatePermission()
Kedaluwarsa.

Membuat dan mengembalikan instans SocketPermission baru kelas.

Equals(Object)
Kedaluwarsa.

Mengembalikan nilai yang menunjukkan apakah instans ini sama dengan objek tertentu.

(Diperoleh dari Attribute)
GetHashCode()
Kedaluwarsa.

Mengembalikan kode hash untuk instans ini.

(Diperoleh dari Attribute)
GetType()
Kedaluwarsa.

Mendapatkan dari instans Type saat ini.

(Diperoleh dari Object)
IsDefaultAttribute()
Kedaluwarsa.

Ketika ditimpa di kelas turunan, menunjukkan apakah nilai instans ini adalah nilai default untuk kelas turunan.

(Diperoleh dari Attribute)
Match(Object)
Kedaluwarsa.

Saat ditimpa di kelas turunan, mengembalikan nilai yang menunjukkan apakah instans ini sama dengan objek tertentu.

(Diperoleh dari Attribute)
MemberwiseClone()
Kedaluwarsa.

Membuat salinan dangkal dari saat ini Object.

(Diperoleh dari Object)
ToString()
Kedaluwarsa.

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Implementasi Antarmuka Eksplisit

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)
Kedaluwarsa.

Memetakan sekumpulan nama ke sekumpulan pengidentifikasi pengiriman yang sesuai.

(Diperoleh dari Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)
Kedaluwarsa.

Mengambil informasi jenis untuk objek, yang dapat digunakan untuk mendapatkan informasi jenis untuk antarmuka.

(Diperoleh dari Attribute)
_Attribute.GetTypeInfoCount(UInt32)
Kedaluwarsa.

Mengambil jumlah antarmuka informasi jenis yang disediakan objek (baik 0 atau 1).

(Diperoleh dari Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)
Kedaluwarsa.

Menyediakan akses ke properti dan metode yang diekspos oleh objek.

(Diperoleh dari Attribute)

Berlaku untuk

Lihat juga