WebSecurity Property - CurrentUserId
❮ WebSecurity
အဓိပ္ပါယ်
CurrentUserId ပိုင်ဆိုင်မှုသည် WebSecurity ဒေတာဘေ့စ် ရှိ လက်ရှိအသုံးပြုသူအတွက် ID (ပင်မသော့) ဖြစ်သည်။
C# နှင့် VB Syntax
WebSecurity.CurrentUserId
ဥပမာများ
ဥပမာ C#
@{
int value;
value=WebSecurity.CurrentUserId;
}
<p>Current User ID is:
@value</p>
ဥပမာ VB
@Code
Dim value as Integer
value=WebSecurity.CurrentUserId
End Code
<p>Current User ID is:
@value</p>
ပြီလေ။
CurrentUserId ပိုင်ဆိုင်မှုကို ဖတ်ရန်သာဖြစ်သည် ။ ကုဒ်ဖြင့် ပြောင်းလဲ၍မရပါ။
အသုံးပြုသူပရိုဖိုင်ဇယားနှင့် အဖွဲ့ဝင်ဇယားရှိ WebSecurity ဒေတာဘေ့စ် တွင် အသုံးပြုသူကို ခွဲခြားသတ်မှတ်ရန် ဤပိုင်ဆိုင်မှုကို အသုံးပြုသည် ။
အမှားများနှင့် ခြွင်းချက်များ
လက်ရှိ အသုံးပြုသူအကောင့်ဝင်ခြင်းမရှိပါက CurrentUserId ပိုင်ဆိုင်မှုသည် -1 ကို ပြန်ပေးသည်။
WebSecurity အရာဝတ္တု သို့ ဝင်ရောက်ခွင့်မှန်သမျှ သည် InvalidOperationException ကို ပစ်ချ ပါက-
- InitializeDatabaseConnection () နည်းလမ်းကို မခေါ်ဆိုပါ။
- SimpleMembership ကို စတင်ခြင်းမပြုပါ (သို့မဟုတ် ဝဘ်ဆိုဒ်ဖွဲ့စည်းပုံတွင် ပိတ်ထားသည်)
❮ WebSecurity