The following method is used in a web form application to save 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 because it will save various information that will be used in various parts of the application.
What is the best way to create Sessions
?
Using the class? What care should be taken in this approach?
Or Creating multiple% of 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, excessive use of Sessions
will overwhelm server memory!
How can I check the memory consumption of the Sessions
of an application on the server?
Would you like to do this via a web application form?