诺基亚 e5-00 上的 asp.net 身份验证
我正在尝试在诺基亚 e5-00 设备中使用 asp.net 身份验证登录。在explorer、firefox、android设备等下登录过程成功。但在诺基亚设备中,即使身份验证成功,HttpContext.Current.User.Identity.IsAuthenticated
仍为 false。
这是我的登录方法:
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
仍然是 false。
但在所有其他浏览器中 IsAuthenticated 都是 true 并且一切都很好。
所有诺基亚设备都会出现此行为。检查后,我看到存储在诺基亚中的cookie,但IsAuthenticated仍然是错误的。
什么会导致这个问题?诺基亚设备出了什么问题?
I am tring to login using asp.net authentication in nokia e5-00 device. The login proccess success under explorer, firefox, android device and so on. But in the nokia device the HttpContext.Current.User.Identity.IsAuthenticated
is false even though the authentication succeeded.
Here is my login method:
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);
}
Later, in the aspx page, when I try to get the user, HttpContext.Current.User.Identity.IsAuthenticated
is still false.
But in all other browsers IsAuthenticated is true and everything is fine.
This behavior happens in all nokia devices. After checking, I see the the cookie stored in the nokia but IsAuthenticated is still false.
What can cause to this problem? What is wrong with the nokia devices??
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我真的不知道问题是什么,但这就是我解决问题的方法:
而是使用我使用的
public static void Login(User user)
:再次,我不确定是什么区别或者为什么这个有效,而我原来的方法却不起作用。
如果有人有答案,我会很高兴知道。
谢谢。
I don't really knows what was the problem, but this is how I solved it:
Instead the use of my
public static void Login(User user)
I used:Again, I am not sure what is the difference or why does this work while my original method doesn't.
If anyone has an answer, I'll be glad to know.
Thanks.