2010-03-02 55 views
0
protected void Login1_LoggedIn(object sender, EventArgs e) 
{ 
    { 
     User.SetUser(Login1.UserName // and what is user ID ? 

以及如何在其他模塊中檢查用戶是否已通過身份驗證?如何檢查用戶授權時間和用戶ID :)

+0

你能解釋一下'User'屬於哪個庫? – 2010-03-02 12:37:00

回答

2

要測試用戶進行身份驗證:

HttpContext.Current.User.Identity.IsAuthenticated 

爲了讓自己的用戶名,如果認證:

HttpContext.Current.User.Identity.Name 
+0

非常感謝你,但如何http://stackoverflow.com/questions/2363100/membership-how-to-set-userid-to-integer-s-and-not-encrypted ...我可以使用一些整數值作爲ID? – Cynede 2010-03-02 12:41:13