Membership provider properties not being read from web.config
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"
applic开发者_运维问答ationName="/" />
</providers>
</roleManager>
Since my provider class is quite huge I am not posting it here but will post some parts of it if requested.
Does this help: How do I call Initialize on a custom MembershipProvider? - Posting the code that initializes the provider in the post would be 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.
精彩评论