Addi
Addi

Reputation: 301

SqlMembershipProvider initialize method not being called

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.

Upvotes: 0

Views: 1192

Answers (1)

Michael Petrotta
Michael Petrotta

Reputation: 60942

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.

Upvotes: 1

Related Questions