因此,当一个用户登录我的应用程序时,所有当前用户都成为该用户

pro*_*don 0 c# asp.net

我想弄清楚我的程序的哪个部分导致了这个错误.

我有多个页面都继承自PageBase.他们从中获取用户个人资料PageBase.这是从PageBase以下位置获取用户名的函数:

uiProfile = ProfileManager.FindProfilesByUserName(CompanyHttpApplication.Current.Profile.UserName)
Run Code Online (Sandbox Code Playgroud)

CompanyHttpApplication我有

    public static CompanyHttpApplication Current
    {
        get { return (CompanyHttpApplication)HttpContext.Current.ApplicationInstance; }
    }
Run Code Online (Sandbox Code Playgroud)

    public CompanyProfileInfo Profile
    {
        get
        {
            return profile ??
                   (profile =
                    ProfileManager.FindProfilesByUserName(ProfileAuthenticationOption.Authenticated,
                                                          User.Identity.Name).Cast
                        <CompanyProfileInfo>().ToList().First());
        }
        private set { profile = value; }
    }
Run Code Online (Sandbox Code Playgroud)

不幸的是,我没有编写代码的这一部分,并且执行它的程序员不再在项目中.是否有任何一个可以解释为什么,当另一个用户登录时(当我使用该应用程序时),我成为那个用户?

jve*_*ema 5

HttpContext.Current.ApplicationInstance是全局共享的.这不是每个用户.因此,您有一个共享配置文件,它会立即覆盖您的新用户登录时最初设置的内容.