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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:18:45+00:00 2026-06-05T10:18:45+00:00

I have below form written in mvc3 razor. I want to display a message

  • 0

I have below form written in mvc3 razor. I want to display a message when user has entered incorrect password. I have placed a label to display message but dont know how to accomplish show/hide in mvc. Please help.

@using (Html.BeginForm("Authenticate", "Authorization", FormMethod.Post, new { autocomplete = "off" }))
{
    < div>
    < fieldset>
        <legend > User Information </legend>

        <div class="editor-label">
            @Html.Label("Password")

            @Html.TextBox("password")
            @Html.ValidationMessageFor(m => m.password)
            @Html.Label("Incorrect Password")
        </div>
        <p>
            @Html.Hidden("tab", ViewData["tab"])
            <input type="submit" value="Submit" />
        </p>

    </fieldset>
</div>
}
  • 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-05T10:18:47+00:00Added an answer on June 5, 2026 at 10:18 am

    In the controller action that is supposed to validate the credentials you could add a modelstate error:

    ModelState.AddModelError("password", "The username or password is incorrect");
    

    Create a new ASP.NET MVC application using the built-in wizard in Visual Studio and navigate to ~/Controller/AccountController.cs. Then look at the LogOn POST action. It adds a general modelstate error when the credentials are invalid:

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

    and this error is displayed using a ValidationSummary helper inside the view:

    @Html.ValidationSummary(true, "Login was unsuccessful. Please correct the errors and try again.")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the code below on form so that the user submits the form
In the dialog form below, I have 2 buttons: Save & Cancel. When user
I have a simple form for this scenario written in razor/webmatrix. I would like
I have written a form which has 3 text inputs and one file input.
I have WPF application, In one of My WPF form has TextBlock. I placed
I have a form written below: <table> <tr> <td>Worker Type:</td> <td><input type=text id=WorkerTypeTB/></td> </tr>
I have below html code in one of the opensource project. <form action=/wiki/bin/view/Main/Search> <div
I have a table with a form below it. You can fill out the
I have just started to develop the form below and I have the following
I have a basic unordered list with an input field/form below it. I would

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.