2
The following method is used in a web form application to store logged-in user information:
public Usuario UsuarioLogado
{
get
{
if (Session["Usuario"] != null)
return (Usuario)Session["Usuario"];
else
return null;
}
set
{
Session["Usuario"] = value;
}
}
In case I use a class as it will store various information that will be used in various parts of the application.
What is the best way to create Sessions?
Using class? What precautions should be taken in this approach?
Or Creating several Sessions individual?
Session["ForcaTrocarSenha"] = usuario.FirstOrDefault().bit_altera_senha;
Session["SenhaAtual"] = usuario.FirstOrDefault().txt_senha.ToString();
Session["Login"] = usuario.FirstOrDefault().txt_login.ToString();
Session["IdUsuario"] = usuario.FirstOrDefault().int_id_usuario.ToString();
In my understanding the excessive use of Sessions will overload the server memory!
How to check the memory consumption of Sessions of an application on the server?
You could do this via a web form application?