1
When 2 users access at the same time the system, somehow it confuses the users, not only the name, but their permissions as well...
I am assigning the session after logging into Actionfilter
public class UsuarioAttribute : ActionFilterAttribute
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
int idUsuario= new UsuarioNegocio().GetIdByExternalId(decodedToken.ExternalUserId.ToInt32());//Id vem de um token
Usuario usuario = new UsuarioNegocio().GetById(idUsuario);
filterContext.HttpContext.Session["Usuario"] = usuario;
}
And in Basecontroller I have the following method to recover the session:
public Usuario GetCurrentUser()
{
return (Usuario)HttpContext.Session["Usuario"];
}
Has anyone ever had this problem with session?
Maybe it’s because you’re using a static variable. So when another user logs in, it’s updated, unless you save the object. Try a Global.
– denis