Alright so I have a task, that I have to let the client try to enter the password 3 times, if he doesn’t enter the right password in 3 times, it will redirect him to another page, The thing is that I don’t know how can I use the session, how can I do like ++ or something.
Session["counter"] = 0;
And I am trying to do the following:
Session["counter"]++;
How can I detect if the client tried to enter the password 3 times?
Thanks
When you want to update that, read the value and convert it to int and then increase, save back
EDIT : As per the comment, This is how you can check the counter value. I wrapped the checking inside 2 methods to set and get, you can even use Properties as others mentioned.
and when user tries to login( in your button click / action method ), check the Current value