WindowsIdentity.IsAnonymous 属性

定义

获取一个值,该值指示系统是否将用户帐户标识为匿名帐户。

public:
 virtual property bool IsAnonymous { bool get(); };
public virtual bool IsAnonymous { get; }
member this.IsAnonymous : bool
Public Overridable ReadOnly Property IsAnonymous As Boolean

属性值

如果用户帐户是匿名帐户,则为 true;否则为 false

示例

以下代码演示如何使用 IsAnonymous 属性来检测系统是否将用户帐户标识为匿名帐户。 此代码示例是为 WindowsIdentity 类提供的一个更大示例的一部分。

if (  !windowsIdentity->IsAnonymous )
{
   propertyDescription = String::Concat( propertyDescription, ", is not an Anonymous account" );
}
if (!windowsIdentity.IsAnonymous)
{
    propertyDescription += " is not an Anonymous account";
}
If Not windowsIdentity.IsAnonymous Then
    propertyDescription += " is not an Anonymous account"
End If

注解

属性 IsAnonymous 同时检测 Windows 匿名标识和方法 GetAnonymous 返回的匿名标识。

当 Internet Information Services (IIS) 允许匿名访问时,通常仅从基于 ASP.NET 的应用程序内遇到匿名帐户。

适用于