?
Dieses Dokument verwendet PHP-Handbuch für chinesische Websites Freigeben
CurrentUserId 屬性是當(dāng)前用戶在 WebSecurity 數(shù)據(jù)庫中的 ID(主鍵)。
WebSecurity.CurrentUserId
@{
int value;
value=WebSecurity.CurrentUserId;
}
<p>Current User ID is: @value</p>
@Code
Dim value as Integer
value=WebSecurity.CurrentUserId
End Code
<p>Current User ID is: @value</p>
CurrentUserId 屬性是只讀的。它不能通過代碼更改。
該屬性用于識別 WebSecurity 數(shù)據(jù)庫中用戶資料表和會員表中的用戶。
如果當(dāng)前沒有用戶登錄,則 CurrentUserId 屬性返回 -1。
在下面的情況下,任何對 WebSecurity 對象的訪問將拋出一個 InvalidOperationException:
名稱 | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |