ASP.Net MVC3 Razor 网站会话变量在 CHROME 中消失
我正在使用 Telerik MVC 开源控件使用 ASP.net MVC3 razor 开发一个网站。 我借助会话变量来跟踪登录的用户。 例如 - 用户登录
Session.Add("LoggedInUserId", loggedInUser.BillerUserId);
Session.Add("LoggedInUserEmail", loggedInUser.BillerUserEmail);
Session.Add("LoggedInUserType", loggedInUser.BillerUserTypeId);
Session.Add("LoggedInUser", loggedInUser);
每个控制器的 ActionResult 内部后,我查看会话变量并确定用户是否有权访问该视图。这种方法对于 IE 和 IE 来说效果很好。火狐。但我在 Chrome 中遇到了一个奇怪的情况。设置会话变量后使用 Chrome 时,我可以成功加载第一个视图(会话变量有其值)。但在此之后,如果用户单击菜单,将他重定向到不同的视图(在任何控制器内),则会话变量将为空。 我访问会话为 -
HttpContext.Current.Session["LoggedInUser"]
我正在使用最新版本的 Chrome (17.0) 和 Cookies &启用 JavaScript。 请帮忙...
谢谢, SDD
I am working on an website with ASP.net MVC3 razor using the Telerik MVC open source controls.
I keep track of the logged in user with the help of session variables.
eg - After the user logs in
Session.Add("LoggedInUserId", loggedInUser.BillerUserId);
Session.Add("LoggedInUserEmail", loggedInUser.BillerUserEmail);
Session.Add("LoggedInUserType", loggedInUser.BillerUserTypeId);
Session.Add("LoggedInUser", loggedInUser);
Inside the ActionResult for every controller, I look at the session variables and decide if the user has access/permissions to the view. This approach works fine for IE & Firefox. But I face a strange situation in Chrome. When using Chrome after the Session variables are set, I can successfully load the first View ( session variables have their values) . But after this if the user clicks on the menu which will redirect him to a different view (inside any controller) the Session variables are null.
I access the session as -
HttpContext.Current.Session["LoggedInUser"]
I am using the latest version of Chrome (17.0) with Cookies & Javascript enabled.
Please help...
Thanks,
sdd
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试将 favicon.ico 添加到您网站的根文件夹。
请参阅本文。
Try to add favicon.ico to the root folder of your site.
See this article.