SecurityPermissionAttribute.ControlPolicy 属性
获取或设置一个值,该值指示是否声明了查看并操作安全策略的权限。
**命名空间:**System.Security.Permissions
**程序集:**mscorlib(在 mscorlib.dll 中)
语法
声明
Public Property ControlPolicy As Boolean
用法
Dim instance As SecurityPermissionAttribute
Dim value As Boolean
value = instance.ControlPolicy
instance.ControlPolicy = value
public bool ControlPolicy { get; set; }
public:
property bool ControlPolicy {
bool get ();
void set (bool value);
}
/** @property */
public boolean get_ControlPolicy ()
/** @property */
public void set_ControlPolicy (boolean value)
public function get ControlPolicy () : boolean
public function set ControlPolicy (value : boolean)
属性值
如果声明了操作安全策略的权限,则为 true;否则为 false。
示例
下面的代码示例演示如何使用 ControlPolicy 属性拒绝查看和操作安全策略的能力。有关完整的代码示例,请参见 SecurityPermissionAttribute 类。
' Set the Assertion,UnmanagedCode, ControlAppDomain, ControlDomainPolicy, ontrolEvidence,
' ControlPolicy, ControlPrincipal, ControlThread, Execution, Flags, Infrastructure,
' RemotingConfiguration, SerializationFormatter, and SkipVerification properties.
<SecurityPermissionAttribute(SecurityAction.Deny, Assertion:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlAppDomain:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlDomainPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlEvidence:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPolicy:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlPrincipal:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, ControlThread:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Execution:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, Flags:=SecurityPermissionFlag.NoFlags), _
SecurityPermissionAttribute(SecurityAction.Deny, Infrastructure:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, RemotingConfiguration:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SerializationFormatter:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, SkipVerification:=True), _
SecurityPermissionAttribute(SecurityAction.Deny, UnmanagedCode:=True)> _
Public Shared Sub DenySecurityPermissions()
// Set the ControlPolicy property.
[SecurityPermissionAttribute(SecurityAction.Deny, ControlPolicy = true)]
[SecurityPermissionAttribute(SecurityAction::Deny,ControlPolicy=true)]
// Set the ControlPolicy property.
// Set the ControlPolicy property.
/** @attribute SecurityPermissionAttribute(SecurityAction.Deny,
ControlPolicy = true)
*/
平台
Windows 98、Windows 2000 SP4、Windows Millennium Edition、Windows Server 2003、Windows XP Media Center Edition、Windows XP Professional x64 Edition、Windows XP SP2、Windows XP Starter Edition
.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求。
版本信息
.NET Framework
受以下版本支持:2.0、1.1、1.0
请参见
参考
SecurityPermissionAttribute 类
SecurityPermissionAttribute 成员
System.Security.Permissions 命名空间