Share via


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 匿名身分識別和匿名識別。

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

適用於