Hi there,
I have an application which stores session variables.
public static class Container
{
public static string FirstSession
{
get
{
if (HttpContext.Current.Session["FirstSession"] != null)
{
return HttpContext.Current.Session["FirstSession"].ToString();
}
return null;
}
set
{
HttpContext.Current.Session["FirstSession"] = value;
}
}
public static string SecondSession
{
get
{
if (HttpContext.Current.Session["SecondSession"] != null)
{
return HttpContext.Current.Session["SecondSession"].ToString();
}
return null;
}
set
{
HttpContext.Current.Session["SecondSession"] = value;
}
}
}
In the table of enabled users I can have two possibilities
+--------+---------+---------+
| First | Second | User |
+--------+---------+---------+
| M00 | B00 | Marvin |
| M00 | | Jack |
+--------+---------+---------+
This is the user recognition
public void sp_user()
{
using (MySqlConnection myCon =
new MySqlConnection(ConfigurationManager.ConnectionStrings["cn"].ConnectionString))
{
using (MySqlCommand command =
new MySqlCommand("sp_user", myCon))
{
try
{
command.CommandTimeout = 2147483;
command.Connection.Open();
command.CommandType = CommandType.StoredProcedure;
command.Parameters.Clear();
command.Parameters.AddWithValue("@sp_usr", usr.ToString().ToUpper());
command.Parameters.Add(new MySqlParameter("@sp_FirstSession", MySqlDbType.LongText));
command.Parameters["@sp_FirstSession"].Direction = ParameterDirection.Output;
command.Parameters.Add(new MySqlParameter("@sp_SecondSession", MySqlDbType.VarChar));
command.Parameters["@sp_SecondSession"].Direction = ParameterDirection.Output;
command.ExecuteNonQuery();
command.Connection.Close();
string sp_FirstSession = command.Parameters["@sp_FirstSession"].Value.ToString();
string sp_SecondSession = command.Parameters["@sp_SecondSession"].Value.ToString();
Container.FirstSession = sp_FirstSession.ToString();
Container.SecondSession = sp_SecondSession.ToString();
}
catch (Exception ex)
{
throw new ApplicationException("operation failed!", ex);
}
finally
{
}
}
}
}
The problem is when you enable or disable a user in the "Second" column of the enabled users table.
If I enable a user also in the Second column directly from the enabled users table and if I subsequently disable him directly from the enabled users table, the web page continues to show him enabled always in the second column, e.g.
I disable the user Marvin from the second column
+--------+---------+---------+
| First | Second | User |
+--------+---------+---------+
| M00 | | Marvin |
| M00 | | Jack |
+--------+---------+---------+
When Marvin accesses the web page he continues to remain enabled in the B00 section.
It seems like there is something stored in the application that does not recognize the user opt-out.
I have tried without success to delete user sessions.
Can you help me?
Thanks