【发布时间】:2015-05-17 15:20:08
【问题描述】:
在我们迁移到 Azure 农场后,我已将 Azure 会话状态提供程序 (redis) 隐含到我的 asp.net mvc 应用程序中,但是一些授权页面将我重定向到登录页面! 那是因为我在某些操作中使用了 User.Identity.Name 或 User.Identity.IsAuthenticated !! 我是否必须将 User.Identity.Name 替换为:
// instead of below line
//Boolean usern = User.Identity.IsAuthenticated;
// is below lines :
Boolean usern = "";
object objValue = Session["usersession"];
if (objValue != null)
{ usern = true;}
else {usern = false;}
是吗,如果不是,为什么用户有时会重定向到再次登录!!!
【问题讨论】:
-
换句话说,Redis azure session 是否意味着它自己为会员提供者,所以当获取 User.Identity.Name 时来自 Redis 会话!
-
您是否在 web.config 中定义了您的机器密钥?
-
汤米,请添加您的评论作为答案
标签: asp.net asp.net-mvc azure cloud session-state