Click here to Skip to main content
13,346,480 members (66,569 online)

How to block a user account after 3 invalied attempts

mahesh.b.p.c asked:

Open original thread
Hi folk's

Can any one help me out ,i done coding for if attempts 3 invalid user attempts by taking int static count variable,in that i have one drawback ,if one user made 2 invalid attempts ,and other user made 1st time invalid attempt and this account is blocking ,How can i rectify this problem can any one help me....

I placing my code below please check it out yar and tell me with one is the better option .....

static int count = 0;
    public void  count_log()//this my user count static function............
        BAL_ClassLibrary.Rcm_service.LoginEntities get_login_details = login_values();
        if (count >2)
            Loginbal objbal=new Loginbal();
             ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*Your Account is blocked')", true);
               count = 0;

            ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "Result", "alert('*Invalied username or password')", true);

I am calling this function, when user made invalid user attempt to login...
and i incrementing the count value.....
Tags: C# (C#4.0), ASP.NET


When answering a question please:
  1. Read the question carefully.
  2. Understand that English isn't everyone's first language so be lenient of bad spelling and grammar.
  3. If a question is poorly phrased then either ask for clarification, ignore it, or edit the question and fix the problem. Insults are not welcome.
  4. Don't tell someone to read the manual. Chances are they have and don't get it. Provide an answer or move on to the next question.
Let's work to help developers, not make them feel stupid.
Please note that all posts will be submitted under the The Code Project Open License (CPOL).

Advertise | Privacy |
Web02 | 2.8.180111.1 | Last Updated 26 Mar 2009
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100