EventLogPermission 类
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
Code Access Security is not supported or honored by the runtime.
控制事件日志的代码访问权限。
public ref class EventLogPermission sealed : System::Security::Permissions::ResourcePermissionBase
public sealed class EventLogPermission : System.Security.Permissions.ResourcePermissionBase
[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 EventLogPermission : System.Security.Permissions.ResourcePermissionBase
[System.Serializable]
public sealed class EventLogPermission : System.Security.Permissions.ResourcePermissionBase
type EventLogPermission = class
inherit ResourcePermissionBase
[<System.Obsolete("Code Access Security is not supported or honored by the runtime.", DiagnosticId="SYSLIB0003", UrlFormat="https://aka.ms/dotnet-warnings/{0}")>]
type EventLogPermission = class
inherit ResourcePermissionBase
[<System.Serializable>]
type EventLogPermission = class
inherit ResourcePermissionBase
Public NotInheritable Class EventLogPermission
Inherits ResourcePermissionBase
- 继承
- 属性
注意
代码访问安全性 (CAS) 已在所有版本的 .NET Framework 和 .NET 中弃用。 如果使用与 CAS 相关的 API,最新版本的 .NET 不会遵循 CAS 注释,并会生成错误。 开发人员应寻求用于完成安全任务的替代方法。
不授予对部分受信任的代码的 EventLogPermission。 读取和写入事件日志的能力使代码能够执行各种操作,如以另一个应用程序的名义发布事件日志消息。
备注
如果由事件日志的 EventLog.Source 属性指定的事件源不存在,则创建新的事件源。 若要在 Windows Vista 与更高版本的 Windows 或 Windows Server 2003 中创建事件源,您必须拥有管理特权。
此要求的原因是必须搜索所有事件日志(包括安全性),以确定事件源是否唯一。 从 Windows Vista 开始,用户无权访问安全日志;因此, SecurityException 会引发 。
从 Windows Vista 开始,用户帐户控制 (UAC) 确定用户的权限。 如果您是内置的 Administrators 组的成员,将为您分配两个运行时访问令牌:一个标准用户访问令牌和一个管理员访问令牌。 默认情况下,您拥有标准用户角色。 若要执行访问安全日志的代码,必须先将特权从标准用户提升为管理员。 你可以通过以下方式执行此操作:右键单击应用程序图标并指示需以管理员身份运行。
Event |
已过时.
初始化 EventLogPermission 类的新实例。 |
Event |
已过时.
用指定的访问级别和要使用的计算机的名称,初始化 EventLogPermission 类的新实例。 |
Event |
已过时.
用指定的权限项初始化 EventLogPermission 类的新实例。 |
Event |
已过时.
初始化具有指定权限状态的 EventLogPermission 类的一个新实例。 |
Any |
已过时.
指定要用来表示任何通配符的字符。 (继承自 ResourcePermissionBase) |
Local |
已过时.
指定要用来表示局部引用的字符。 (继承自 ResourcePermissionBase) |
Permission |
已过时.
获取或设置描述给予资源的访问权限类型的枚举值。 (继承自 ResourcePermissionBase) |
Permission |
已过时.
获取此权限请求的权限项集合。 |
Tag |
已过时.
获取或设置标识处于保护中的资源的字符串数组。 (继承自 ResourcePermissionBase) |
产品 | 版本 (已过时) |
---|---|
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
Windows Desktop | 3.0, 3.1 (5, 6, 7, 8, 9) |