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 6969517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:35:28+00:00 2026-05-27T16:35:28+00:00

I have a forms login in my web site using ASP.NET MVC with C#.

  • 0

I have a forms login in my web site using ASP.NET MVC with C#. All of the user profiles are stored in a Customer table that has the following columns:

  • ID
  • First_Name
  • username
  • password
  • ActiveWebLog

with ActiveWebLog = 0 meaning the user has not yet activated their account, and ActiveWebLog = 1 meaning the user can login.

This is my Login action in my Controller :

    public ActionResult LogOnCustomer()
    {
        return View();
    }

    [HttpPost]
    public ActionResult LogOnCustomer(LogOnModel model, string returnUrl)
    {

        if (ModelState.IsValid)
        {

            if (MembershipService.ValidateCustomer(model.UserName, model.Password))
            {

                this.AuthCustomer = MembershipService.AuthCustomer;

                FormsService.SignIn(model.UserName, model.RememberMe);

                if (!String.IsNullOrEmpty(returnUrl))
                {
                    return Redirect(returnUrl);
                }
                else
                {
                    return RedirectToAction("RedirectPage", "Account");
                }

            }
            else
            {
                ModelState.AddModelError("", "The user name or password provided is incorrect.");
            }

        }

        // If we got this far, something failed, redisplay form
        return View(model);

    }

What I want is to set ActiveWebLog = -2 when the user inputs an incorrect username or password 5 times.

Does anyone know how to do that?

  • 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-05-27T16:35:29+00:00Added an answer on May 27, 2026 at 4:35 pm
    • Add a LoginAttemptCount column to your table.

    • Check user credentials against the database.

    • If no user name, fail. It may be advisable to not tell the user that the username does not exist, because that supports grinding attempts to locate user names.

    • If the user name matches but the LoginAttemptCount => 5 (or any number), fail.

    • If the user name matches but the password is bad, increment LoginAttemptCount and fail.

    • If the user name and password are good (hopefully you are using a hashed password) and LoginAttemptCount < 5, reset LoginAttemptCount to zero.

    If you use this methodology, you technically don’t need to modify the ActiveWebLog column when the user exceeds the bad password limit (but you certainly could).

    I would put the business rules for this inside a separate class library. Your controller will probably have the basic logic to invoke this class library and modify your view based on the resulting status codes.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using Forms authentication in ASP.NET MVC website and I store user account login
I have a ASP.NET MVC site that is locked down using Forms Authentication. The
I have an ASP.NET site on a public web server, where users login using
I have simple jQuery Mobile site created using asp.net mvc 2 and uses basic
I have an existing asp.net mvc website that uses basic forms authentication. The site
I have a standard ASP.NET MVC site with forms authentication. Users log in via
I have a Asp.net web site built on C# with Forms Authentication. We use
I have a simple ASP.NET 4 site. I am using Forms Authentication. I have
I have developed a web app in ASP.NET MVC which we are using internally.
I have an asp.net site. Its a mixture of web forms and MVC2. I

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.