Registering wants me to fill password retrieval fields

Nov 4, 2010 at 5:42 PM
Edited Nov 5, 2010 at 4:06 PM

Hello Mr Jon Galloway and all pupils,

After filling cart, when I checkout, I'm prompted to register. But It irremediably fails with this error message:

Account creation was unsuccessful. Please correct the errors and try again.
  • The password retrieval answer provided is invalid. Please check the value and try again.


I've explored the account files but I haven't found anything related to the password retrieval question/answer. Same search and same result with Administration Tool. The only moment I can see such fields is when I'm creating a new user with Administration Tool as in the tutorial.

I'm using the downloaded version of MusicStore v1.0 with VWD 2010 Express French version. Anyone with the same issue ?

Thanks in advance for your help.

Nov 4, 2010 at 7:49 PM

When you click on the Register link, you should see a form that prompts you to enter four fields:

  • User name
  • Email address
  • Password
  • Confirm password

The default password policy requires that you include a number and a non-numeric password, e.g. password123!

Does your password meet that policy?



Nov 5, 2010 at 3:15 PM
Edited Nov 5, 2010 at 3:27 PM



User name (text field): Thomas

Email (text field):

Password (password field): password456!

Confirm password (password field): password456!

Fails with the above error message.

Nov 5, 2010 at 4:23 PM
Edited Nov 5, 2010 at 4:25 PM

There's a setting to require membersip question and answer, which I believe should be false in a default MVC 2 project. Can you check your the membership section of your web.config? It should look like this (note that requiresQuestionAndAnswer="false"):

	<clear />
	<add name="AspNetSqlMembershipProvider"
	connectionStringName="ApplicationServices" enablePasswordRetrieval="false"
	enablePasswordReset="true" requiresQuestionAndAnswer="false"
	requiresUniqueEmail="false" maxInvalidPasswordAttempts="5"
	minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0"
	passwordAttemptWindow="10" applicationName="/" />
Nov 5, 2010 at 6:03 PM
Edited Nov 10, 2010 at 12:52 PM

As you told me, I could check that such a section does exist in a default MVC2 project.

Nevertheless, I could check that web.config file in your downloadable project is still the same as mine and doesn't contain the above section.

Furthermore, adding this section "as is" raises a server error when "Checkout>>" button is pressed:

"Connexion name 'ApplicationServices' can't be found in applications configuration, or connection string is empty. "

with the sixth line of the above code hilighted.

Next I've replaced connectionStringName 'ApplicationServices' by "MusicStoreEntities" and then managed to view Register form.

But, on validation, VWD Debugger stops with an error pointing CreateUser method from AccountModels.cs and a message nearly the same as previous one:

"ArgumentException exception wasn't managed by user code. An error occurred attempting to initialize a System.Data.SqlClient.SqlConnection object. Incorrect value or invalid syntax. Parameter name: connectionString."

Press F5 to continue causes server to stop with message " System.ArgumentException: Unmanaged keyword : 'metadata' "

Could you help me, one more time please ?  Thanks in advance.

Nov 9, 2010 at 4:42 PM
Edited Nov 9, 2010 at 4:47 PM

I just downloaded the MVC store archive and I can confirm that web.config does NOT contain a 'membership' section.

Registration fails with the message "The password retrieval answer provided is invalid. Please check the value and try again."


please post a fix. Thanks !



I looked at changeset 2217b2db4a2b and compared it to the previous version - it is apparent that the 'membership' section was taken out.

Nov 10, 2010 at 1:10 PM
	<add name="MusicStoreEntities" 
		connectionString="metadata=res://*/Models.StoreDB.csdl|res://*/Models.StoreDB.ssdl|res://*/Models.StoreDB.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MvcMusicStore.mdf;Integrated Security=True;User Instance=True;MultipleActiveResultSets=True&quot;" 
		providerName="System.Data.EntityClient" />
	 <add name="ApplicationServices"
		connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" 
		providerName="System.Data.SqlClient" /> 
Here's connectionString section from Web.config in the previous version (beta).
ApplicationServices connectionString was obviously also defined in a default MVC2 project.
Then bug is definately fixed.
Thanks both.
Nov 15, 2010 at 12:23 PM



I am also having the same issue with this tutorial - the user registration does not include fields for question and answer, but when posted, responds with the above error message.

I have tried your fix - adding the "ApplicationServices" section to web.config but this made no difference I'm afraid.

It squawked quite badly when I tried to add the <membership> section from the top of the page.

I could not use your example "MusicStoreEntities" code as my connection string is different from yours - it connects to a SQL instance, not Express.

I would really like to complete this tutorial, so any further information on how to circumvent this problem would be greatly appreciated.



Nov 15, 2010 at 4:34 PM


There's no relation between "MusicStoreEntities" and present bug.

If you can correctly see Album list and details from your Home page or Cart page then your MusicStoreEntities connection string is functional, of course.

This bug (in my case, every other code from project was functional) was only due to an uncompleted web.config file.

Have you tried to take web.config file directly from the oldest version of the project (current version has also an uncompleted web.config file: that was the issue i faced) ?

You'll just have to replace original MusicStoreEntities connection string by yours, if I understand what you say.

Tell me.

Nov 17, 2010 at 8:46 AM

Hi Thomas,

That worked fine thank you. I downloaded version v.08 from here and copied the <membership> section into the Web.config file. This worked fine for me.

Many thanks for your help in this.


Jan 12, 2011 at 6:49 PM

I had the same problem also. Im happy with the fix, but how can i reference the Password/Question fields for future use for my Model/View?? Checked the AccountModel.cs and there is no reference to these fields anywhere.

Jan 30, 2011 at 11:46 AM

In my case using MVC 3 example i needed to change in AccountModels.cs line 127 this:


 MembershipCreateStatus status;
            _provider.CreateUser(userName, password, email, "question", "answer", true, null, out status);
            return status;

MembershipCreateStatus status;



Hope this helps


Mar 6, 2011 at 12:02 AM

Where and How is the Default Password Policy Set?


Mar 6, 2011 at 2:35 AM


Check out the November 5 post, that is in your web config file.

Mar 6, 2011 at 4:09 PM

Thanks madisonJames. I didn't catch that

Jun 6, 2011 at 8:15 PM

this can be solved by doing the following:

adding entries for Question and Anser to the Register Model on AccountModels.cs and labels/textboxes of Register.cshtml files

and also in AccountModels change the IMembershipService to

public interface IMembershipService
        int MinPasswordLength { get; }

        bool ValidateUser(string userName, string password);
        MembershipCreateStatus CreateUser(string userName, string password, string email, string passwordQuestion, string passwordAnswer);
        bool ChangePassword(string userName, string oldPassword, string newPassword);

and the MembershipCreateUser to

 public MembershipCreateStatus CreateUser(string userName, string password, string email, string passwordQuestion, string passwordAnswer)
            if (String.IsNullOrEmpty(userName)) throw new ArgumentException("Value cannot be null or empty.", "userName");
            if (String.IsNullOrEmpty(password)) throw new ArgumentException("Value cannot be null or empty.", "password");
            if (String.IsNullOrEmpty(email)) throw new ArgumentException("Value cannot be null or empty.", "email");
            if (String.IsNullOrEmpty(passwordQuestion)) throw new ArgumentException("Value cannot be null or empty.", "passwordQuestion");
            if (String.IsNullOrEmpty(passwordAnswer)) throw new ArgumentException("Value cannot be null or empty.", "passwordAnswer");            

            MembershipCreateStatus status;
            _provider.CreateUser(userName, password, email, passwordQuestion, passwordAnswer, true, null, out status);
            return status;
Jun 8, 2011 at 6:40 PM

Can you provide the changes you made to Register.cshtml?

Jun 11, 2011 at 6:19 AM

The simplest way to get this working is to copy in the AccountModels.cs from the Assets folder - it's already set up to handle the question and answer. Otherwise, you make he change acidutzu suggested above.

Nov 14, 2011 at 6:27 PM

I have discovered the real reason why the "Account creation was unsuccessful. Please correct the errors and try again. The password retrieval answer provided is invalid. Please check the value and try again." 

appears every time you try to check out in MVC Music Store. It's actually quite simple though I am not sure why they never caught when they put the Music Store code out in the first place....

Take a look at the code

            <legend>Account Information</legend>
            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            <div class="editor-field">
                @Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)
            <div class="editor-label">
                @Html.LabelFor(m => m.Email)
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Email)
                @Html.ValidationMessageFor(m => m.Email)
            <div class="editor-label">
                @Html.LabelFor(m => m.Password)
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            <div class="editor-label">
                @Html.LabelFor(m => m.ConfirmPassword)
            <div class="editor-field">
                @Html.PasswordFor(m => m.ConfirmPassword)
                @Html.ValidationMessageFor(m => m.ConfirmPassword)

Notice that the classes are all expecting to the SAME parameter! I tested and registered an account as follows:




Confirm Password:

Worked like a charm. So the issue is that you need to change the parameters each expression is taking.

Hopefully this will help. :-)



Nov 21, 2011 at 5:53 PM

Scratch that above. If you change the parameters it will not work. It does work when you enter the fields in like I said at the bottom. I just disabled the authentication in the web.config and continued past the registration issue.