In my Global.asax, I have this code in Session_Start ():
UserIntranet user = new UserIntranet(); user.Login = this.Request.LogonUserIdentity.Name.Split('\\')[1]; Session["user"] = user as UserIntranet;
In my BaseController, I have this property:
public UserIntranet UserIntranet { get { return Session["user"] as UserIntranet; } }
It works in all mine controllers that use this base controller, but not in my main BaseController constructor.
This Null Session ...
Try this in my BaseController:
public BaseController() { ViewBag.UserMenu = this.UserIntranet.Login; }
Why? How can I get the user login directly in my BaseController? What is the best way?
source share