1

I am implementing the MembershipProvider. So I want to refer to the implementation of sqlMemberShipProvider by Microsoft in .NET reflector and find an interesting thing:

for RequiresQuestionAndAnswer, it retrieve value of _RequiresQuestionAndAnswer directly.

public override bool RequiresQuestionAndAnswer
{
    get
    {
        return this._RequiresQuestionAndAnswer;
    }
}

But where the _RequiresQuestionAndAnswer get the value? I think there must be some logic retrieve value from web.config, right? But I can't find. Why? Where is the code?

freeflying
  • 215
  • 3
  • 12

4 Answers4

2

As of Version 6.6:

  1. Click on the backing _RequiresQuestionAndAnswer field in the getter-body. This will take you to the field-declaration and highlight the field on the browser-panel.
  2. Right-Click on the field on the browser-panel and choose Analyze on the context-menu.
  3. Open up the Assigned By node from the analyzer-tree. Notice that the only method assigning to the field is the public Initialize method.
  4. Right-click on the method and choose Go to Member on the context-menu. You will see that this method assigns the field to the value of a call to SecUtility.GetBooleanValue with appropriate arguments.
  5. For further information, investigate the implementation of this method by clicking on the method-call.
Ani
  • 111,048
  • 26
  • 262
  • 307
1

Look at the Initialize method. Here's how the field is initialized:

this._RequiresUniqueEmail = SecUtility.GetBooleanValue(config, "requiresUniqueEmail", true);

So yes it is read from the config file.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
0

It is read from the web.config when the membership provider is initialized. It defaults to TRUE

mhenrixon
  • 6,179
  • 4
  • 40
  • 64
0

In reflector, choose disassemble the class it self. Then scroll to the bottom and click on Expend Methods.

Now you can search for this member and check who it's used.

HuBeZa
  • 4,715
  • 3
  • 36
  • 58