?
This document uses PHP Chinese website manual Release
CurrentUserId 屬性是當(dāng)前用戶(hù)在 WebSecurity 數(shù)據(jù)庫(kù)中的 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 屬性是只讀的。它不能通過(guò)代碼更改。
該屬性用于識(shí)別 WebSecurity 數(shù)據(jù)庫(kù)中用戶(hù)資料表和會(huì)員表中的用戶(hù)。
如果當(dāng)前沒(méi)有用戶(hù)登錄,則 CurrentUserId 屬性返回 -1。
在下面的情況下,任何對(duì) WebSecurity 對(duì)象的訪問(wèn)將拋出一個(gè) InvalidOperationException:
名稱(chēng) | 值 |
---|---|
Namespace | WebMatrix.WebData |
Assembly | WebMatrix.WebData.dll |