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 會偵測方法傳 GetAnonymous 回的 Windows 匿名身分識別和匿名識別。

當 Internet Information Services (IIS) 允許匿名存取時,通常只會在以 ASP.NET 為基礎的應用程式中遇到匿名帳戶。

適用於