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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:08:26+00:00 2026-06-06T10:08:26+00:00

I’m creating a client contact using Membership.CreateUser and I’d like to supply a generated

  • 0

I’m creating a client contact using Membership.CreateUser and I’d like to supply a generated password each time a contact is created. The production team will be setting up accounts for new client contacts.

The problem I’m running into is when I pass through the generic password, the method fails. When I supply my own password through the model it works fine.

I’m looking for a work-around or a better practice.

Thanks in advance for you help!

Here is an example of the code:

        [HttpPost]
    public ActionResult RegisterClientContact(RegisterClientContactViewModel model)
    {
        if (ModelState.IsValid)
        {
            //Create Generic password - First initial Last initial 1234
            string genericPassword = model.FirstName.Substring(0, 1).ToLower() + model.LastName.Substring(0, 1).ToLower() + "1234";


            //Attempt to register the Client Contact
            MembershipCreateStatus createStatus;
            Membership.CreateUser(model.Email, genericPassword, model.Email, null, null, true, null, out createStatus);



            if (createStatus == MembershipCreateStatus.Success)
            {
                Roles.AddUserToRole(model.Email, "Client");
                FormsAuthentication.SetAuthCookie(model.Email, false /*create persistent cookie*/);

                Person person = new Person();
                person.FirstName = model.FirstName;
                person.LastName = model.LastName;
                person.Email = model.Email;
                person.Phone = model.Phone;
                person.Active = true;

                db.Persons.Add(person);
                db.SaveChanges();

                ClientContact clientPerson = new ClientContact();
                clientPerson.ClientPersonId = person.Id;
                clientPerson.Title = model.Title;
                clientPerson.ClientId = model.ClientId;

                db.ClientPersons.Add(clientPerson);
                db.SaveChanges();

                return RedirectToAction("Index", "ClientContact");
            }
        }

        return View("An Error has occured");
    }

By the way, it seems I should be able to pass in my own password given this article.

  • 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-06T10:08:29+00:00Added an answer on June 6, 2026 at 10:08 am

    It’s likely due to the fact that your default passwords don’t meet the ASP.NET Membership default password complexity requirements. The default password needs to be 7 characters. The exception should tell you exactly what the problem is. See the following MSDN page for more details on how to configure Membership’s minRequiredPasswordLength setting.

    Membership.MinRequiredPasswordLength Property

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has
I've got a string that has curly quotes in it. I'd like to replace
I am reading a book about Javascript and jQuery and using one of the
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I am trying to render a haml file in a javascript response like so:

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.