PrincipalPolicy PrincipalPolicy PrincipalPolicy PrincipalPolicy Enum


指定应该如何为应用程序域创建用户和标识对象。Specifies how principal and identity objects should be created for an application domain. 默认值为 UnauthenticatedPrincipalThe default is UnauthenticatedPrincipal.

public enum class PrincipalPolicy
public enum PrincipalPolicy
type PrincipalPolicy = 
Public Enum PrincipalPolicy


NoPrincipal NoPrincipal NoPrincipal NoPrincipal 1

不应该创建任何用户或标识对象。No principal or identity objects should be created.

UnauthenticatedPrincipal UnauthenticatedPrincipal UnauthenticatedPrincipal UnauthenticatedPrincipal 0

应该为未经身份验证的实体创建用户和标识对象。Principal and identity objects for the unauthenticated entity should be created. 未经身份验证的实体的 Name 设置为空字符串 (""),IsAuthenticated 设置为 falseAn unauthenticated entity has Name set to the empty string ("") and IsAuthenticated set to false.

WindowsPrincipal WindowsPrincipal WindowsPrincipal WindowsPrincipal 2

应该创建反映与当前执行线程相关的操作系统标记的用户和标识对象,并且应该将关联的操作系统组映射到角色。Principal and identity objects that reflect the operating system token associated with the current execution thread should be created, and the associated operating system groups should be mapped into roles.


出于性能原因,直到需要它们,则不会创建默认主体和标识对象。For performance reasons, the default principal and identity objects are not created until they are needed. 如果某一主体显式添加到当前线程,不创建默认主体和主体的策略设置将被忽略。If a principal is explicitly added to the current thread, a default principal is not created and the principal policy setting is ignored.

受信任的主机可以通过指定另一个使用这些值来覆盖默认的用户策略SetPrincipalPolicy方法的AppDomainA trusted host can override the default principal policy by specifying another of these values using the SetPrincipalPolicy method of an AppDomain.