Reading membership section from web.config in C#

Posted by PlayKid on Stack Overflow See other posts from Stack Overflow or by PlayKid
Published on 2010-06-08T11:26:34Z Indexed on 2010/06/08 11:32 UTC
Read the original article Hit count: 237

Filed under:
|
|
|

Hi there,

I have created a custom MembershipProvider class, so far so good, however, I am not sure how to read the configuration settings from the web.config file.

I tried to search from Google and Stackoverflow, seems like someone also experiencing my problem and asked, but no answer has been given.

It should be a simple thing, but I am very new in web development, so reading settings from web.config seems away too technical to me.

Here is my settings:

 <membership defaultProvider="CustomMembershipProvider">
  <providers>
    <clear/>
    <add name="CustomMembershipProvider"
         type="Test.Models.CustomMembershipProvider,Test"
         passwordFormat="Hashed"
         connectionStringName="ApplicationServices"
         minRequiredPasswordLength="8"
         minRequiredNonalphanumericCharacters="0"
         maxInvalidPasswordAttempts="5"
         enablePasswordReset="false"
         enablePasswordRetrieval="false"
         requiresQuestionAndAnswer="false"
         applicationName="/"/>
  </providers>
</membership

I would like to read the minRequiredPasswordLength setting, please assist.

Thanks alot in advance.

© Stack Overflow or respective owner

Related posts about c#

Related posts about mvc