Lock the account, if user puts wrong password 3 times

Arunprasad T S V 1 Reputation point

I am using viewstate to store the count of the login attempts. If wrong password means , I increase the count. If this count > 3 , then i lock the account. But my problem is:
I have 2 users : James and John. James puts 2 times wrong password. The viewstate count sets 2. After that in the same screen John tries to login. He gave wrong password. So John account will be locked at the first attempt. Because the viewstate count be 3. How can i handle this situation? Kindly give solution.

Thank you.

A set of technologies in the .NET Framework for building web applications and XML web services.
3,414 questions
{count} votes