首页 > 解决方案 > 多个用户登录时,Session["variable"] 被覆盖

问题描述

我面临一个问题HttpContext.Current.Session["variable"]。当多个用户在同一网络中同时登录我的 Web 应用程序时,它会被覆盖。该应用程序托管在 Windows Azure 上。

我获取登录用户的方法是这样的:

public static string GetLoginUser()
{
    Login login = (Login)HttpContext.Current.Session["Login"];
    return login.User;
}

当 2 个或更多用户在不同的计算机和不同的会话中使用该应用程序时,其中一个Session["Login"]优先于其他所有。但它不违背Session["variable"]范围?

标签: c#asp.net.netasp.net-mvcsession

解决方案


推荐阅读