I am currently working on an ASP.NET website. On one of my pages, I had a static field for the currently registered CompanyId user.
private static Guid _CompanyId = Company.Get().CompanyId;
The company .Get () returns information about the company of the current user, where the UserId is retrieved using:
System.Web.Security.Membership.GetUser();
But when you log in as another user, in antoher company, Company.Get (). CompanyId will return Guid from the first company.
Am I missing the point of using static fields, or does this have a different reason? I fixed this by replacing all references to _CompanyId in my code with Company.Get (). CompanyId for a quick fix, but this is not a good solution.
source
share