Hi,
I have a login page in my website. I want to give only 3 attempts for login the users, if the user doesnot login successfully in 3 attempts his/her id has been blocked.
How this will be done?
Plz reply....
thanx..
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
V S N Raju KanumuriPosted May 9, 2012, 1:58 AM
Follow these steps
1. add a column "active" in your register table
2.when a user register into ur site set this active column to true
3. in login button click
protect void btnlogin_Click()
{
if(viewstate["attempt"]==null)
{
viewstate["attempt"]=0;
}
if( dt.Rows.Count>0 )
{
string status =dt.Rows[0]["active"].Tostring();
if(status=="true")
{
//redirect
}
else
{
// u r blocked msg
}
}
else
{
viestatte["attempt"]=Convert.ToInt32( viestatte["attempt"] )+1;
// login faild message
}
if( Convert.ToInt32( viestatte["attempt"] ) >3)
{
// write code to update the active column value to false
}
hope this will help u
Nitesh KejriwalPosted May 9, 2012, 2:10 AM