用户资料问题 [英] User Profile problem

查看:77
本文介绍了用户资料问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我的asp.net应用程序有问题.
我的应用程序中有两个不同的用户,即USER1和USER2,在同一应用程序中向它们提供了不同的功能.当我在一个系统中使用USER1登录而在另一系统中使用USER2登录时.并在以我以USER1登录的系统上显示USER2的方式浏览这些系统中的页面

我正在使用两台完全不同的笔记本电脑,两个不同的网络和
即使是两个不同的Web浏览器,看起来我的两台笔记本电脑都使用了相同的会话缓存.我们正在使用静态类来维护用户个人资料


在这里,我将我用来维护用户个人资料的代码放在静态类中

Hi

I have a problem in my asp.net application.
I have two different users namely USER1 and USER2 in my application to whom different features are provided in the same application. When I login with USER1 in one system and USER2 in another system. and browse through the pages in these systems somewhere on the way it displays USER2 on the system to which I logged in as USER1

I''m on two completely different laptops, two different networks and
even two different web browsers, it looks the same session cache is used on both of my laptops somehow. We are using a static class to maintain the user profile


here i put my code that i am using to maintain the user profile in static class

       Utility.CurrentUserProfile = new Utility.UserProfile();
       Utility.CurrentUserProfile.User = new Peoplemaster();
DataRow dtData_People = SysAdmin.GetBiz_Peoplemaster(nlogIn);
       Utility.CurrentUserProfile.User.Mail = dtData_People.ToString();
       Utility.CurrentUserProfile.User.Password = dtData_People.ToString();




这是我的课




here my class

public class Utility
    {
        public Utility()
        {

        }
              
        static UserProfile userProfile = new UserProfile();
        public static UserProfile CurrentUserProfile { get { return userProfile; } set { userProfile = value; } }


        public class UserProfile
        {
           
            public Peoplemaster User { get; set; }
           
        }
    }





谢谢





thanks

推荐答案

amlurun写道:
amlurun wrote:

在这里,我把我正在使用的代码在静态类中维护用户配置文件

here i put my code that i am using to maintain the user profile in static class



这不是一个好方法.

UserProfile不能为静态;否则所有会话将共享同一实例.

尽量不要将UserProfile设为静态,这将起作用.



This is not a good approach.

UserProfile should not be static; otherwise same instance will be shared by all the sessions.

Try not to make the UserProfile static, this will work.


这篇关于用户资料问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆