views:

24

answers:

1

I'm having a problem with a custom Membership implementation for ASP.NET using EF. The thing is, my web.config features the default values for the provider but at runtime those default are only being read in Initialize() the first time provider is instantiated (that happens for instance when I request the Register view via GET but when I fill in the form and POST to the controller the Initialize() on the provider class doesn't get called and all the provider settings are null or default value types value.

This is my web.config section:

    <membership>
        <providers>
            <clear />
            <add name="AspNetSqlMembershipProvider"
                 type="BN.Membership.EfMembershipProvider, BN"
                 connectionStringName="ApplicationServices"
                 enablePasswordRetrieval="false"
                 enablePasswordReset="true"
                 requiresQuestionAndAnswer="false"
                 requiresUniqueEmail="true"
                 maxInvalidPasswordAttempts="5"
                 minRequiredPasswordLength="6"
                 minRequiredNonalphanumericCharacters="0"
                 passwordAttemptWindow="10"
                 applicationName="/" />
        </providers>
    </membership>
    <roleManager enabled="false">
        <providers>
            <clear />
            <add name="AspNetSqlRoleProvider"
                 type="BN.Membership.EfRoleProvider, BN"
                 connectionStringName="ApplicationServices"
                 applicationName="/" />
        </providers>
    </roleManager>

Since my provider class is quite huge I am not posting it here but will post some parts of it if requested.

A: 

Does this help: Does this help: stackoverflow.com/questions/623545/… - Posting the code that initializes the provider in the post would help- Posting the code that initializes the provider in the post would helpful.


You don't HAVE to use a CSL pattern to use Ninject with this. CSLs are semi-useful though although I have no idea why you'd choose to change your DI framework in the middle of a project.

jfar
I added CSL and I sort of like it. I like having some common ground for accessing instances of types provided by the chosen DI framework.
mare