ZoneIdentityPermission 類別

定義

警告

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

定義程式碼來源區域的識別權限。 此類別無法獲得繼承。

public ref class ZoneIdentityPermission sealed : System::Security::CodeAccessPermission
public sealed class ZoneIdentityPermission : System.Security.CodeAccessPermission
[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 ZoneIdentityPermission : System.Security.CodeAccessPermission
[System.Serializable]
public sealed class ZoneIdentityPermission : System.Security.CodeAccessPermission
[System.Serializable]
[System.Runtime.InteropServices.ComVisible(true)]
public sealed class ZoneIdentityPermission : System.Security.CodeAccessPermission
type ZoneIdentityPermission = class
    inherit CodeAccessPermission
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type ZoneIdentityPermission = class
    inherit CodeAccessPermission
[<System.Serializable>]
type ZoneIdentityPermission = class
    inherit CodeAccessPermission
[<System.Serializable>]
[<System.Runtime.InteropServices.ComVisible(true)>]
type ZoneIdentityPermission = class
    inherit CodeAccessPermission
Public NotInheritable Class ZoneIdentityPermission
Inherits CodeAccessPermission
繼承
ZoneIdentityPermission
屬性

備註

警告

程式代碼啟用安全性 (CAS) 在所有版本的 .NET Framework 和 .NET 中已被取代。 最新版本的 .NET 不接受 CAS 批注,並在使用 CAS 相關 API 時產生錯誤。 開發人員應尋求替代方案來完成安全性工作。

此許可權可以判斷呼叫程式代碼是否來自特定區域。 區域會根據因特網選項進行設定,並由 IInternetSecurityManager 和相關 API 從 URL 對應。 只定義許可權的確切區域相符專案;URL 只能屬於一個區域。

  • 近端內部網路區域:本機內部網路區域用於位於公司內部網路的內容。 由於伺服器位於公司的防火牆內,因此內部網路上的內容會獲指派較高的信任層級。

  • 信任的網站區域:信任的網站區域會用於位於被視為比因特網上其他網站更可信賴或值得信任的網站上的內容。 使用者可以使用此區域,將較高層級的信任指派給特定因特網網站。 使用者需要將這些信任網站的 URL 對應至這個區域。 根據預設,信任網站區域中的網站不會收到高於因特網區域中的網站。 如果使用者或公司想要將它所包含的網站授與此區域的信任層級變更為較高的信任層級。

  • 因特網區域:因特網區域用於不屬於另一個區域的因特網網站。 默認設定只允許從這些網站下載的程式碼,僅能存取用戶電腦上的資源。 未對應到其他區域的網站會自動落在此區域。

  • 受限制的網站區域:限制的網站區域用於包含可能造成或先前可能造成問題的網站。 此區域可用來防止從這些網站下載的程式代碼在使用者的計算機上執行。 使用者需要將這些未受信任網站的 URL 對應至這個區域。

  • 本機計算機區域:本機計算機區域是隱含區域,用於存在於使用者計算機上的內容。 除了本機系統上 Internet Explorer 所快取的內容以外,用戶電腦上找到的內容會以非常高的信任等級來處理。

重要

從 .NET Framework 4 開始,不會使用身分識別許可權。

建構函式

ZoneIdentityPermission(PermissionState)
已淘汰.

使用指定的 ZoneIdentityPermission 初始化 PermissionState 類別的新執行個體。

ZoneIdentityPermission(SecurityZone)
已淘汰.

初始化 ZoneIdentityPermission 類別的新執行個體,以表示指定的區域身分識別。

屬性

SecurityZone
已淘汰.

取得或設定目前 ZoneIdentityPermission 所代表的區域。

方法

Assert()
已淘汰.

宣告即使堆疊中較高層的呼叫端未獲得資源存取權限,呼叫程式碼仍可透過呼叫這個方法的程式碼要求權限,來存取受保護的資源。 使用 Assert() 會造成安全性問題。

(繼承來源 CodeAccessPermission)
Copy()
已淘汰.

建立並傳回目前權限的相同複本。

Demand()
已淘汰.

如果在呼叫堆疊中較高的所有呼叫端都尚未被授與由目前執行個體所指定之權限,則會在執行階段強制執行 SecurityException

(繼承來源 CodeAccessPermission)
Deny()
已淘汰.
已淘汰.

防止呼叫堆疊中較高的呼叫端,使用程式碼呼叫此方法來存取目前執行個體所指定的資源。

(繼承來源 CodeAccessPermission)
Equals(Object)
已淘汰.

判斷指定的 CodeAccessPermission 物件是否等於目前的 CodeAccessPermission

(繼承來源 CodeAccessPermission)
FromXml(SecurityElement)
已淘汰.

透過 XML 編碼,重新建構具有指定狀態的權限。

GetHashCode()
已淘汰.

取得 CodeAccessPermission 物件的雜湊碼,其適合用於雜湊表這類的雜湊演算法和資料結構。

(繼承來源 CodeAccessPermission)
GetType()
已淘汰.

取得目前執行個體的 Type

(繼承來源 Object)
Intersect(IPermission)
已淘汰.

建立並傳回目前權限與指定權限交集的權限。

IsSubsetOf(IPermission)
已淘汰.

判斷目前權限是否為指定權限的子集。

MemberwiseClone()
已淘汰.

建立目前 Object 的淺層複製。

(繼承來源 Object)
PermitOnly()
已淘汰.

防止呼叫堆疊中較高的呼叫端,使用程式碼呼叫此方法來存取目前執行個體所指定之資源以外的所有資源。

(繼承來源 CodeAccessPermission)
ToString()
已淘汰.

建立並傳回目前權限物件的字串表示。

(繼承來源 CodeAccessPermission)
ToXml()
已淘汰.

建立權限和其目前狀態的 XML 編碼方式。

Union(IPermission)
已淘汰.

建立目前權限與指定權限聯集的權限。

適用於

另請參閱