2011-07-26 49 views
0

我正在使用諾基亞e5-00設備上的asp.net驗證登錄。在explorer,firefox,android等設備下登錄成功。但是在諾基亞設備中,即使認證成功,HttpContext.Current.User.Identity.IsAuthenticated也是錯誤的。
這裏是我的登錄方法:諾基亞e5-00上的asp.net驗證

public static void Login(User user) 
     { 
      HttpResponse Response = HttpContext.Current.Response; 
      HttpRequest Request = HttpContext.Current.Request; 

      FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, 
       user.Id.ToString(), DateTime.Now, DateTime.Now.AddHours(12), true, 
       user.Id.ToString()); 

      string data = FormsAuthentication.Encrypt(ticket); 
      HttpCookie cookie = new HttpCookie(FormsAuthentication.FormsCookieName, data); 
      cookie.Expires = ticket.Expiration; 

      Response.Cookies.Add(cookie); 

      string redirectUrl = UserPages.Home; 
      Response.Redirect(redirectUrl, false); 
     } 

後來,在aspx頁面,當我嘗試獲取用戶,HttpContext.Current.User.Identity.IsAuthenticated還是假的。

但在所有其他瀏覽器IsAuthenticated是真實的,一切都很好。

這種情況發生在所有諾基亞設備中。檢查後,我看到存儲在諾基亞的cookie,但IsAuthenticated仍然是錯誤的。

什麼會導致這個問題?諾基亞設備有什麼問題?

回答

0

我真的不知道是什麼問題,但是這是我如何解決它:

取而代之的是利用我public static void Login(User user)我用:

FormsAuthentication.RedirectFromLoginPage(user.Id.ToString(), true); 

同樣,我不知道是什麼是差異還是爲什麼這個工作,而我的原始方法沒有。

如果有人有答案,我會很高興知道。

謝謝。