configuration - Custom SimpleMembershipProvider not initialized correctly -


i have custom simplemembershipprovider implemented in application service layer. provider has of own properties inherited base classes. although overridden initialize method called on provider, , executes without exceptions, inherited properties incorrect default values such 0 or int32.maxvalue. need them initialized values provided in configuration. how can achieve this?

the configuration looks this:

<membership defaultprovider="abcmembershipprovider">   <providers>     <clear/>     <add name="abcmembershipprovider"          type="abc.services.abcmembershipservices, abc.services"          connectionstringname="membership"          applicationname="abc"          enablepasswordretrieval="false"          enablepasswordreset="true"          requiresquestionandanswer="false"          requiresuniqueemail="true"          passwordformat="hashed"          maxinvalidpasswordattempts="3"          passwordattemptwindow="10"          passwordvalidityperiod="30" />   </providers> </membership> 

the provider overrides initialize method this:

public override void initialize(string name, system.collections.specialized.namevaluecollection config) {     if (config.containskey("passwordvalidityperiod"))     {         int.tryparse(config["passwordvalidityperiod"], out _passwordvalidityperiod);         config.remove("passwordvalidityperiod");     }     base.initialize(name, config); } 

during service startup, simplemembershipprovider initialised follows:

if (!websecurity.initialized)         websecurity.initializedatabaseconnection("membership", "systemuser", "userid", "username", false); 

the initialize method called membership system during websecurity.initializedatabaseconnection() call

looking @ source code, reason occurs because various membershipprovider properties given default value simplemembershipprovider when provider has been initialized. example:

// inherited membershipprovider ==> forwarded previous provider if provider hasn't been initialized public override int maxinvalidpasswordattempts {     { return initializecalled ? int32.maxvalue : previousprovider.maxinvalidpasswordattempts; } } 

the way round override these properties in custom provider.


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -