Click here to Skip to main content
15,911,646 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi I am doing my application in 3 tier and I have a column in my database to minus the number of tries to login.

Need some example

int counter = 0

if(username !=null && password !=null && counter == 0)
{
Successful login
}

else if (username ==null && password ==null )
{
counter = counter + 1
Two more tries
}

I am stuck for the next statement do I need to store my counter in a session
Posted
Updated 3-Jul-14 4:54am
v2
Comments
ZurdoDev 3-Jul-14 10:39am    
Just write the code. Where are you stuck?
polkj 3-Jul-14 10:43am    
I can minus one time only i am using if and multiple else if statement
CHill60 3-Jul-14 10:48am    
Post what you have tried so far and explain your problem - use the Improve Question link above
OriginalGriff 3-Jul-14 10:48am    
This is not a good question - we cannot work out from that little what you are trying to do.
Remember that we can't see your screen, access your HDD, or read your mind.
"I can minus one time only i am using if and multiple else if statement" means pretty much nothing - we need to see what your code does at present, or we are just guessing what you prroblem might be.
Use the "Improve question" widget to edit your question and provide better information.
[no name] 3-Jul-14 11:30am    
"do I need to store my counter in a session"... is that your actual question? Do you want to store that in a session variable? Then go ahead and do that. BTW, your strings will most likely never be null.

1 solution

Quote:
do I need to store my counter in a session
Yes. But ViewState makes more sense here as this value will only be used on this page. So, better save in ViewState and read from there.

If you don't save it anywhere, each time it goes through your code, it again assigns 0 to the counter
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900