Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7739337
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:29:50+00:00 2026-06-01T08:29:50+00:00

Alright so I have a task, that I have to let the client try

  • 0

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

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T08:29:51+00:00Added an answer on June 1, 2026 at 8:29 am
    int counter=1;
    Session["counter"]=counter;
    

    When you want to update that, read the value and convert it to int and then increase, save back

    if(Session["counter"]!=null)
    {
     counter=Convert.ToInt32(Session["counter"]);
    }
    counter++;
    Session["counter"]=counter;
    

    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.

    private int GetLoginAttempts()
    {
        int counter=0;
        if(Session["counter"]!=null)
        {
         counter=Convert.ToInt32(Session["counter"]);
        }
      return counter;
    }
    private void IncreaseLoginAttempts()
    {
       if(Session["counter"]!=null)
       {
         counter=Convert.ToInt32(Session["counter"]);
       }
       counter++;
       Session["counter"]=counter;
    }
    

    and when user tries to login( in your button click / action method ), check the Current value

       if(GetLoginAttempts()==3)
       {
            //This means user already tried 3 times, show him a message !
       }
       else
       {
            //Do the login process, If login fails, increase the counter 
           IncreaseLoginAttempts()
       }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Alright, currently I have my SWF hitting a php file that will go and
Alright, I have a server that serves a motion-jpeg stream over http. What I
Alright, I have a performancecounter in my program that calculates the CPU usage. It
Hey, alright so I have a .plist that looks like; <plist version=1.0> <dict> <key>Item
Alright lets say I have a cPlayer class that inherits from cOrganism , which
Alright so let me explain what I'm doing and then I have a couple
Alright, I have a wordpress site, that I want to have a clientportal built
Alright I have a div that contains an image, <div id=image> <img src=images/medium/1.png />
Alright I have a question that seems simple but I haven't been able to
Alright. So I have a very large amount of binary data (let's say, 10GB)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.