我很生气为什么 HttpContext.Current.User.Identity.IsAuthenticated 在登录控件的 LoggedIn 事件中返回 false?
我输入了正确的用户名和密码,因此我进入了登录事件,但 IsAuthenticated 是错误的!
最佳答案
这是因为自从用户登录后页面还没有被回发。整个用户对象还没有被填充,这是一个已知的行为。
请参阅这篇内容丰富的博文:
http://forums.asp.net/t/982749.aspx
上述链接也归功于此相关的 SO QA: Get UserID from ASP.Net Login control LoggedIn event
关于c# - HttpContext.Current.User.Identity.IsAuthenticated 在登录控件 LoggedIn 事件中为 false,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13166107/