GacIdentityPermission 类

定义

注意

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

定义从全局程序集缓存中产生的文件的标识权限。 此类不能被继承。

public ref class GacIdentityPermission sealed : System::Security::CodeAccessPermission
public sealed class GacIdentityPermission : 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 GacIdentityPermission : System.Security.CodeAccessPermission
[System.Runtime.InteropServices.ComVisible(true)]
[System.Serializable]
public sealed class GacIdentityPermission : System.Security.CodeAccessPermission
type GacIdentityPermission = 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 GacIdentityPermission = class
    inherit CodeAccessPermission
[<System.Runtime.InteropServices.ComVisible(true)>]
[<System.Serializable>]
type GacIdentityPermission = class
    inherit CodeAccessPermission
Public NotInheritable Class GacIdentityPermission
Inherits CodeAccessPermission
继承
GacIdentityPermission
属性

注解

注意

代码访问安全性 (CAS) 已在所有版本的 .NET Framework 和 .NET 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求用于完成安全任务的替代方法。

文件要么位于全局程序集缓存中,要么不在全局程序集缓存中。 授予的权限没有变化,因此所有 GacIdentityPermission 对象都是相等的。

重要

从 .NET Framework 4 开始,不使用标识权限。

在.NET Framework版本 1.0 和 1.1 中,即使调用程序集完全受信任,对标识权限的要求也有效。 也就是说,尽管调用程序集具有完全信任,但如果程序集不符合所需的条件,则对标识权限的要求会失败。 从 .NET Framework 版本 2.0 开始,如果调用程序集具有完全信任,则对标识权限的要求无效。 这可确保所有权限的一致性,消除了将标识权限视为特殊情况。

构造函数

GacIdentityPermission()
已过时.

初始化 GacIdentityPermission 类的新实例。

GacIdentityPermission(PermissionState)
已过时.

用完全受限制的 GacIdentityPermission 初始化 PermissionState 类的新实例。

方法

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)
已过时.

创建并返回一个权限,该权限是当前权限和指定权限的并集。

适用于