In my Global.asax, i have this code in the 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's working in all of mines controllers who use this base controller but not in my BaseController Constructor himself.
This session is Null...
Have try this in my BaseController :
public BaseController()
{
ViewBag.UserMenu = this.UserIntranet.Login;/* Null */
}
Why? How can i get the user login directly in my BaseController? What is the better way?