views:

362

answers:

1

I have done a custom implementation of MembershipProvider but for some reason the initialize method is not being invoked and thus my provider is not setting up properly from the config parameters, who invokes it in the first place and how do i get it to work.

+1  A: 

I assume this is an ASP.NET application. Do you have a reference to your membership provider in your web.config (it can also be in your machine.config, but this is lesser used)?

You should have something like the following in the system.web section of your web.config:

<membership defaultProvider="MyCustomMembershipProvider">
    <providers>
     <clear/>
     <add
      name="MyCustomMembershipProvider"
      type="MyNamespace.MyCustomMembershipProvider"
      connectionStringName="..." ... />
    </providers>
</membership>

Make sure also that your provider is inheriting from the System.Web.Security.MembershipProvider abstract class.

See this MSDN article for more detail and examples.

Michael Petrotta