DnsPermission 类

定义

控制对网络上域名系统 (DNS) 服务器的访问权限。Controls rights to access Domain Name System (DNS) servers on the network.

public ref class DnsPermission sealed : System::Security::CodeAccessPermission, System::Security::Permissions::IUnrestrictedPermission
[System.Serializable]
public sealed class DnsPermission : System.Security.CodeAccessPermission, System.Security.Permissions.IUnrestrictedPermission
type DnsPermission = class
    inherit CodeAccessPermission
    interface IUnrestrictedPermission
Public NotInheritable Class DnsPermission
Inherits CodeAccessPermission
Implements IUnrestrictedPermission
继承
属性
实现

注解

默认权限允许所有本地和 Intranet 区域应用程序访问 DNS 服务,不允许 DNS 权限访问 Internet 区域应用程序。The default permissions allow all local and Intranet zone applications to access DNS services, and no DNS permission for Internet zone applications.

构造函数

DnsPermission(PermissionState)

创建 DnsPermission 类的新实例,该类或者允许无限制的 DNS 访问,或者不允许 DNS 访问。Creates a new instance of the DnsPermission class that either allows unrestricted DNS access or disallows DNS access.

方法

Assert()

声明调用代码能够通过调用此方法的代码,访问受权限请求保护的资源,即使未对堆栈中处于较高位置的调用方授予访问该资源的权限。Declares that the calling code can access the resource protected by a permission demand through the code that calls this method, even if callers higher in the stack have not been granted permission to access the resource. 使用 Assert() 会引起安全问题。Using Assert() can create security issues.

(继承自 CodeAccessPermission)
Copy()

创建当前权限实例的相同副本。Creates an identical copy of the current permission instance.

Demand()

如果未对调用堆栈中处于较高位置的所有调用方授予当前实例所指定的权限,则在运行时强制 SecurityExceptionForces a SecurityException at run time if all callers higher in the call stack have not been granted the permission specified by the current instance.

(继承自 CodeAccessPermission)
Deny()

防止处于调用堆栈较高位置的调用函数使用可以调用此方法来访问当前实例指定资源的代码。Prevents callers higher in the call stack from using the code that calls this method to access the resource specified by the current instance.

(继承自 CodeAccessPermission)
Equals(Object)

确定指定的 CodeAccessPermission 对象是否等于当前的 CodeAccessPermissionDetermines whether the specified CodeAccessPermission object is equal to the current CodeAccessPermission.

(继承自 CodeAccessPermission)
FromXml(SecurityElement)

以 XML 编码重新构造 DnsPermission 实例。Reconstructs a DnsPermission instance from an XML encoding.

GetHashCode()

获取 CodeAccessPermission 对象的哈希代码,此代码适合在哈希算法和数据结构(例如哈希表)中使用。Gets a hash code for the CodeAccessPermission object that is suitable for use in hashing algorithms and data structures such as a hash table.

(继承自 CodeAccessPermission)
GetType()

获取当前实例的 TypeGets the Type of the current instance.

(继承自 Object)
Intersect(IPermission)

创建一个是当前权限实例与指定权限实例的交集的权限实例。Creates a permission instance that is the intersection of the current permission instance and the specified permission instance.

IsSubsetOf(IPermission)

确定当前权限实例是否是指定权限实例的子集。Determines whether the current permission instance is a subset of the specified permission instance.

IsUnrestricted()

检查对象的整体权限状态。Checks the overall permission state of the object.

MemberwiseClone()

创建当前 Object 的浅表副本。Creates a shallow copy of the current Object.

(继承自 Object)
PermitOnly()

防止处于调用堆栈较高位置的调用函数使用此代码,此代码将调用此方法来访问除当前实例指定的资源以外的所有资源。Prevents callers higher in the call stack from using the code that calls this method to access all resources except for the resource specified by the current instance.

(继承自 CodeAccessPermission)
ToString()

创建并返回当前权限对象的字符串表示形式。Creates and returns a string representation of the current permission object.

(继承自 CodeAccessPermission)
ToXml()

创建 DnsPermission 实例及其当前状态的 XML 编码。Creates an XML encoding of a DnsPermission instance and its current state.

Union(IPermission)

创建一个是当前权限实例与指定权限实例的并集的权限实例。Creates a permission instance that is the union of the current permission instance and the specified permission instance.

显式接口实现

IPermission.Demand() (继承自 CodeAccessPermission)
IStackWalk.Assert() (继承自 CodeAccessPermission)
IStackWalk.Demand() (继承自 CodeAccessPermission)
IStackWalk.Deny() (继承自 CodeAccessPermission)
IStackWalk.PermitOnly() (继承自 CodeAccessPermission)

适用于

另请参阅