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

  • Home
  • SEARCH
  • 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 507863
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T06:50:53+00:00 2026-05-13T06:50:53+00:00

I’ve been playing around with the default MVC 1 site, adding some fields to

  • 0

I’ve been playing around with the default MVC 1 site, adding some fields to the registration section that are used to create a secondary object in the database at sign up time.

I’ve created the view model including the username, email, password and passwordConfirm properties, along with a few others. I then added the type to the inherits attribute on the register page, and in the controller, added a new instance of the model to the ViewData.Model property.

The problem is, when i POST the model back to the server, the passwordConfirm property is always null, no matter what i enter. The password property, is filled in correctly, as are all the other properties.

Is there something special that has to be done to get the passwordConfirm value to get passed?

Here is the relevant code:

RegistrationViewModel.cs:

public class RegistrationViewModel
{
    public string UserName { get; set; }
    public string Password { get; set; }
    public string PasswordConfirm { get; set; }
    public string Email { get; set; }
    public string FirstName { get; set; }
    public string LastName { get; set; }
    public string DisplayName { get; set; }
    public string Address1 { get; set; }
    public string Address2 { get; set; }
    public string City { get; set; }
    public string State { get; set; }
    public string Zip { get; set; }
    public string HomePhone { get; set; }
    public string CellPhone { get; set; }
    public string OtherPhone { get; set; }
    public string Twitter { get; set; }
    public string Bio { get; set; }
    public string DOB { get; set; }
}

AccountController.cs:

public ActionResult Register()
    {
        ViewData.Model = new RegistrationViewModel();
        ViewData["PasswordLength"] = MembershipService.MinPasswordLength;

        return View();
    }

Register.aspx:

<% using (Html.BeginForm()) { %>
    <div>
        <fieldset>
            <legend>Account Information</legend>
            <p>
                <label for="firstname">First Name:</label>
                <%= Html.TextBox("firstname", Model.FirstName) %>
                <%= Html.ValidationMessage("firstname") %>
            </p>
            <p>
                <label for="lastname">Last Name:</label>
                <%= Html.TextBox("lastname", Model.LastName) %>
                <%= Html.ValidationMessage("lastname") %>
            </p>
            <p>
                <label for="username">Username:</label>
                <%= Html.TextBox("username", Model.UserName) %>
                <%= Html.ValidationMessage("username") %>
            </p>
            <p>
                <label for="email">Email:</label>
                <%= Html.TextBox("email", Model.Email) %>
                <%= Html.ValidationMessage("email") %>
            </p>
            <p>
                <label for="zipcode">Zip Code:</label>
                <%= Html.TextBox("zip", Model.Zip) %>
                <%= Html.ValidationMessage("zip") %>
            </p>
            <p>
                <label for="password">Password:</label>
                <%= Html.Password("password", Model.Password) %>
                <%= Html.ValidationMessage("password") %>
            </p>
            <p>
                <label for="confirmPassword">Confirm password:</label>
                <%= Html.Password("confirmPassword",Model.PasswordConfirm) %>
                <%= Html.ValidationMessage("confirmPassword") %>
            </p>
            <p>
                <input type="submit" value="Register" />
            </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-05-13T06:50:53+00:00Added an answer on May 13, 2026 at 6:50 am

    The default model binding behavior is to hydrate your view model by matching HTML element names to view model property names. As a previous answer pointed out, the input element that you use to capture the confirm password is named “confirmPassword” and the view model property is “PasswordConfirm”. If you update your code to make these names match, you should see the confirm password string in the model.

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

Sidebar

Ask A Question

Stats

  • Questions 278k
  • Answers 278k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Read here: http://sixthform.info/steve/wordpress/?cat=2 http://fugato.net/2007/01/20/latex-in-wordpress/ about LaTeX on Wordpress, syntax higlighting… May 13, 2026 at 3:17 pm
  • Editorial Team
    Editorial Team added an answer You can use the single inverted commas (also a unix… May 13, 2026 at 3:17 pm
  • Editorial Team
    Editorial Team added an answer Any CPU with native floating point will have an instruction… May 13, 2026 at 3:17 pm

Related Questions

I've got a string that has curly quotes in it. I'd like to replace
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a French site that I want to parse, but am running into
I have text I am displaying in SIlverlight that is coming from a CMS

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.