title: how to limit login attempts?
body: <p>HI i have to limit the login attempts of the user....and update insert the "yes" if the user exceeds login attempts in the "IsBlocked" column of database</p>
  
  <p>i am working on code...i don't know whats the error in my code i cant icrement the failedattempts.....here is the code i am working on</p>
  
  <pre><code>          SqlConnection con2 = new SqlConnection(connstring);
              string cmd1 = "select Emp_IsBlocked from dbo.PTS_Employee where Emp_Username='" + EmployeeName + "' and Emp_Password='" + Password + "'";
              SqlCommand mycomm2 = new SqlCommand(cmd1, con2);
              con2.Open();
              Object Blocked = mycomm2.ExecuteScalar();
              con2.Close();
              if (Blocked != null)
              {
                  if (Blocked.ToString() == "")
                  {
                      Response.Redirect("~/Transactions.aspx");
                  }
                  else
                  {
                      lblError.Text = "You are Temporarily Blocked for Exceeding Max Number of Login Attempts";
                  }
              }
  
              else
              {
                  _failedAttempts++;
                  //lblError.Text = ("Fail. " + (3 - _failedAttempts));
  
                  if (_failedAttempts == 3)
                  {
                      SqlConnection con1 = new SqlConnection(connstring);
                      SqlCommand mycomm1 = new SqlCommand("SP_IsBlocked", con1);
                      mycomm1.CommandType = CommandType.StoredProcedure;
                      con1.Open();
                      mycomm1.Parameters.Add("@IsBlocked", SqlDbType.VarChar).Value = "Yes";
                      mycomm1.ExecuteNonQuery();
                      con1.Close();
                      lblError.Text = "You are Temporarily Blocked for Exceeding Max Number of Login Attempts";
                  }
  
  
              } 
  </code></pre>
  
  <p>can any say whats wrong in the above code or how to do it....?</p>