tim_chicagopartyanimals
asked on
MembershipCreateUserException "The password-answer supplied is invalid."
I am having a difficult time getting past an error. To start with, I used the Silverlight Business Application template to create the base project and website. I have made some modifications to the default login forms created. I did this so people could register with just a username, email address, and password. This required a number of changes in various spots. For instance, I edited the RegistrationData.vb file that was generated in the server project in the Models folder. This altered the registration xaml child window. I also modified the UserRegistrationService.vb file in the server project services folder so the Membership.CreateUser method so it was only taking the arguments for username, password, and email address. I also wanted to eliminate the need for a non alpha numeric character in the password. Finally, I modified the web.config file to reflect the desired changes. That section of code is currently looking like:
<membership>
<providers>
<remove name="LocalSqlServer"/>
<add name="ChicagoPartyAnimalsM embershipP rovider"
connectionStringName="Loca lSqlServer "
type="System.Web.Security. SqlMembers hipProvide r"
enablePasswordRetrieval="f alse"
enablePasswordReset="false "
requiresQuestionAndAnswer= "false"
applicationName="ChicagoPa rtyAnimals "
requiresUniqueEmail="false "
passwordFormat="Hashed"
maxInvalidPasswordAttempts ="5"
minRequiredPasswordLength= "1"
minRequiredNonalphanumeric Characters ="0"
passwordAttemptWindow="10"
passwordStrengthRegularExp ression="" />
</providers>
</membership>
When I run the project and go to the registration page, I am properly displaying just the 4 fields I desire (username, email, password, confirm password) and when I click the OK button to actually register, I receive the exception listed in the title. I have tried going through everything with a fine tooth comb to see if I can see what I am missing, although thus far I have been completely stumped. It is possible/likely that I have modified something else in the effort to remove the security question and answer details as well as the minimum length and character types for the password that has not been listed here. I just do not understand why I am getting an error related to a security question that is not necessary. Perhaps my assumption that the error is regarding a security question answer is incorrect??? Regardless, and insight would be greatly appreciated.
The StatusCode of the exception view detail is "MembershipCreateStatus.In validAnswe r".
<membership>
<providers>
<remove name="LocalSqlServer"/>
<add name="ChicagoPartyAnimalsM
connectionStringName="Loca
type="System.Web.Security.
enablePasswordRetrieval="f
enablePasswordReset="false
requiresQuestionAndAnswer=
applicationName="ChicagoPa
requiresUniqueEmail="false
passwordFormat="Hashed"
maxInvalidPasswordAttempts
minRequiredPasswordLength=
minRequiredNonalphanumeric
passwordAttemptWindow="10"
passwordStrengthRegularExp
</providers>
</membership>
When I run the project and go to the registration page, I am properly displaying just the 4 fields I desire (username, email, password, confirm password) and when I click the OK button to actually register, I receive the exception listed in the title. I have tried going through everything with a fine tooth comb to see if I can see what I am missing, although thus far I have been completely stumped. It is possible/likely that I have modified something else in the effort to remove the security question and answer details as well as the minimum length and character types for the password that has not been listed here. I just do not understand why I am getting an error related to a security question that is not necessary. Perhaps my assumption that the error is regarding a security question answer is incorrect??? Regardless, and insight would be greatly appreciated.
The StatusCode of the exception view detail is "MembershipCreateStatus.In
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
glad to hear that :)
I'm afraid the solution doesn't work for me. I still get the "The password-answer supplied is invalid." exception when trying to create a new user with this call:
My default web.config looks like this:
And I then replaced it with your solution like this:
I really hope you have a solution for this, I have spent so much time on this problem now!
Thank you!
var newUser = Sitecore.Security.Accounts.User.Create(newMember.Username, newMember.GenerateNewPassword(8));
My default web.config looks like this:
<add name="sql"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="core"
applicationName="sitecore"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true"
maxInvalidPasswordAttempts="256"/>
And I then replaced it with your solution like this:
<membership defaultProvider="sitecore">
<providers>
<clear/>
<add name="sitecore" type="Sitecore.Security.SitecoreMembershipProvider, Sitecore.Kernel" realProviderName="sql" providerWildcard="%" raiseEvents="true"/>
<add name="sql"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="core"
enablePasswordRetrieval="false"
enablePasswordReset="true"
requiresQuestionAndAnswer="false"
applicationName="sitecore"
requiresUniqueEmail="false"
passwordFormat="Hashed"
maxInvalidPasswordAttempts="5"
minRequiredPasswordLength="1"
minRequiredNonalphanumericCharacters="0"
passwordAttemptWindow="10"
passwordStrengthRegularExpression="" />
<add name="switcher" type="Sitecore.Security.SwitchingMembershipProvider, Sitecore.Kernel" applicationName="sitecore" mappings="switchingProviders/membership"/>
</providers>
</membership>
I really hope you have a solution for this, I have spent so much time on this problem now!
Thank you!
ASKER
Cheers!