Click here to Skip to main content
15,917,793 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted
Updated 23-Mar-10 23:45pm
v2

1 solution

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


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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900