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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:09:46+00:00 2026-05-31T15:09:46+00:00

I am using AspNet Membership Provider in MVC 3. I am facing issue in

  • 0

I am using AspNet Membership Provider in MVC 3.
I am facing issue in change password.
I have two functionality in my project

  1. Forgot password : ask security question and based on security answer change password.
  2. Admin change password: a admin can change password of any user without knowing old password or security answer.

Now the issue is that for functionality # 1, i have to make changes in web config for making requiresQuestionAndAnswer="true" for change password so that i can change password only if security answer is valid.

<membership>
      <providers>
        <clear />
        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
      </providers>
    </membership>

and i am using below code for changing password in forgot password:

   string resetPassword = res.ResetPassword(model.PasswordAnswer);
   MembershipService.ChangePassword(model.Username, newPassword, model.NewPassword)

now for situation # 2, where for admin i wants facility to change password of any user without knowing old password or security answer. which is only possible (as i know) by making requiresQuestionAndAnswer="false" .

Note:I am using separate MVC AREA for admin part, so may be a another web config can do some magic.

please suggest how can i have have both the features (reset password with security answer and without security answer) together in single application.

Thanks a lot

  • 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-31T15:09:48+00:00Added an answer on May 31, 2026 at 3:09 pm

    Finally got the answer:
    In web config i set the requiresQuestionAndAnswer="true" so this resolves the issue#1, now for forgot password a security answer is required.

    and for issue#2 where i want the facility for admin to change password of any user without knowing old password or security answer. I have used Reflection for it to change the value of private variable _RequiresQuestionAndAnswer to false then reset the password and then again set its value to true:

    var _requiresQA = Membership.Provider.GetType().GetField("_RequiresQuestionAndAnswer",
            System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic);
        //change the value in the private field
        _requiresQA.SetValue(Membership.Provider, false);
        //do the reset
        tempPassword = user.ResetPassword();
        //set it's original value
        _requiresQA.SetValue(Membership.Provider, true);
    

    I got this solution at : http://djsolid.net/blog/asp.net-membership—change-password-without-asking-the-old-with-question-and-answer

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

Sidebar

Related Questions

I have a project using asp.net mvc and form membership provider . I have
I have a ASP.NET MVC site using Membership Provider. I have trouble testing some
I am using ASP.NET 3.0 MVC with membership provider. I have to make modification
I have .NET MVC 3 project where I use sql membership provider and entity
i have created a MVC application , without using asp.net membership provider, i want
I have been reading up on porting ASP.NET Membership Provider into .NET 3.5 using
I have an ASP.NET 3.5 Web Site using the standard SQL Membership Provider. The
I am using ASPNET membership with 50000 records, and we have another table called
I'm using asp.net 4.0 with asp.net MVC 2.0 and the asp.net membership provider. I
i am extending the default asp.net mvc example.. i am using asp.net membership provider

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.