Im am developing an MVC 5 App.
I have a UserLoginModel class assigned to a Session Variable.
public class UserLoginModel
{
public long User_id { get; set; }
public string Email { get; set; }
public int Rol_id { get; set; }
public string Name { get; set; }
public string LastName { get; set; }
}
private const string SessionKey = "UserLogin";
private readonly HttpContext _httpContext;
public void Save(UserLoginModel user)
{
_httpContext.Session[SessionKey] = user;
}
I need to get the value of this Session UserLogin.User_id from jQuery. I can Access
var variable = '@Session["UserLogin"]';
But it gives me the value that it is class data type:
UserLoginModel
How can I get a specific value like User_id?
Thanks