?
This document uses PHP Chinese website manual Release
HasUserId 屬性是一個(gè)布爾值,指示當(dāng)前用戶在 WebSecurity 數(shù)據(jù)庫中是否具有用戶 ID。
如果當(dāng)前用戶具有用戶 ID,則該屬性值是一個(gè)布爾值 true。默認(rèn)是 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 屬性只驗(yàn)證用戶是否在 WebSecurity 數(shù)據(jù)庫中具有 ID。不驗(yàn)證用戶帳戶是否有效(被確認(rèn)),或者用戶是否已登錄。
請(qǐng)使用 IsConfirmed() 方法來驗(yàn)證用戶是否已被確認(rèn)。
請(qǐng)使用 IsAuthenticated 屬性來驗(yàn)證用戶是否已登錄。
在下面的情況下,任何對(duì) WebSecurity 對(duì)象的訪問將拋出一個(gè) InvalidOperationException:
名稱 | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |