1
Good morning, everyone.
I am currently suffering from a problem and cannot find the solution. I have a login system in ASP.NET C# when I do the authentication everything happens correctly only that there is the problem I need to get the ID value of my database from the user who was authenticated there for that time until the method I use works, i pass the value of the captured ID at login to a public Static variable in a class and it redirects me to the start screen that is correct with the value in the variable.. and then the problem happens, this variable does not save the value for the client’s computer and yes on the server so when someone logs in to the site all the people who access this site will be automatically logged in this login all this because of the Static variable in the class someone knows how to fix it situation that is in eating the judgment.
Thank you from now on!! Kennedy
In my Global class
public static int Cod_Login;
my login validation
DataSet DS = new DataSet();
DS = ValidaLogin(TxtUsuario.Text, TxtSenha.Text);
for (int i = 0; i < DS.Tables[0].Rows.Count; i++)
{
Cod_User = Convert.ToInt32(DS.Tables[0].Rows[i][0] == DBNull.Value ? 0 : DS.Tables[0].Rows[i][0]);
}
if (Cod_User != 0)
{
Class_Global.Cod_Login = Cod_User; //aonde passo o valor para a variavel
Response.Redirect("/Default.aspx");
}
else
{
LblMsg.Text = "CPF e/ou Senha incorretos.";
LblMsg.Visible = true;
}
In my home page after login
if (Class_Global.Cod_Login != 0)
{
//aqui utilizo se o meu código caso for o valor diferente de zero
}
I did it worked, but out of nowhere incredibly the Sesame loses its value...
– Nilza Cieri
I used Session again with the tip from the friend below and managed to keep Session thanks to you...
– Nilza Cieri
Add the following line to the Global_asax.Vb file at Session_start. Session.Timeout = 1500
– Carlos Almeida