?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
HasUserId 屬性是一個布爾值,指示當(dāng)前用戶在 WebSecurity 數(shù)據(jù)庫中是否具有用戶 ID。
如果當(dāng)前用戶具有用戶 ID,則該屬性值是一個布爾值 true。默認是 false。
WebSecurity.HasUserId
@{
bool value;
value=WebSecurity.HasUserId;
}
<p>It is @value that the user has an ID</p>
@Code
Dim value as Boolean
value=WebSecurity.HasUserId
End Code
<p>It is @value that the user has an ID</p>
HasUserID 屬性是只讀的。它不能通過代碼更改。
HasUserId 屬性只驗證用戶是否在 WebSecurity 數(shù)據(jù)庫中具有 ID。不驗證用戶帳戶是否有效(被確認),或者用戶是否已登錄。
請使用 IsConfirmed() 方法來驗證用戶是否已被確認。
請使用 IsAuthenticated 屬性來驗證用戶是否已登錄。
在下面的情況下,任何對 WebSecurity 對象的訪問將拋出一個 InvalidOperationException:
名稱 | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |