Hi folk's
I have a query regarding blocking a user account after 3 invalid user attempts it is web based application ,i want to block user account after 3 invalid account,
my code is in this way.....
static DataTable dt = new DataTable();
DataRow row ;
Loginbal objbal = new Loginbal();
public void count_log()
{
BAL_ClassLibrary.Rcm_service.LoginEntities get_login_details = login_values();
int count = Convert.ToInt32(Session["logincount"]);
Session["loginuid"] = txt_username.Text.Trim();
string username=get_login_details.username1;
if (dt.Rows.Count > 0)
{
if (username == dt.Rows[0]["UserName"].ToString())
{
if (Convert.ToInt32(Session["logincount"]) >= 3)
{
objbal.account_block(get_login_details);
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*Your Account is blocked')", true);
Session["logincount"] = 0;
}
else
{
count += 1;
Session["logincount"] = count;
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*The username or password you entered is incorrect!')", true);
}
}
else
{
int rowcount = dt.Rows.Count;
dt.Rows[0]["UserName"] = username;
Session["logincount"] = 1;
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*The username or password you entered is incorrect!')", true);
}
}
else
{
dt.Columns.Add("UserName", typeof(System.String));
row = dt.NewRow();
int rowcount = dt.Rows.Count;
row["UserName"]=username;
dt.Rows.Add(row);
Session["logincount"] = 1;
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*The username or password you entered is incorrect!')", true);
}
}
i calling this fun when authentication is failed ...
It is working fine after three invalid attempt in database i have column just changing the flag active to inactive
Is fun() make any problem when huge number of users is accessing ...
because i am using static data-set to store the username and further to compare the username ...
please make doubt clear as soon as possible.....
plz help me out