views:

395

answers:

2

I am using the Membership.Provider for security in my MVC Application. I have a forgot password page that asks for your username, and then gives you the secret question on file. My question is how to a check the secret answer against what is on file. I can't seem to find any method that does that besides

Membership.Provider.ResetPassword(userName, secretAnswer)

which basically approves anything I type in.

+2  A: 

There's a setting in the web.config you have to set to tell the Membership Provider to use the secret question.

It's requiresQuestionAndAnswer="true" where you set up the membership provider.

Edit: In your comment requiresQuestionAndAnswer is set to "false" - it should be "true"

Bramha Ghosh
already set I think: <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="TheConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="TheBeerHouse" requiresUniqueEmail="false" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="5" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" passwordStrengthRegularExpression=""/>
Al Katawazi
A: 

This approach may not work if u have hashed passwords

Amol
hashed passwords will have no effect
Bramha Ghosh