C#: Reading MembershipSection from Web.config

Tech-Archive recommends: Fix windows errors by optimizing your registry



I need to read values from the Web.Config xml file, particularly the
<Membership> Section. Using asp.net 2.0, C#.

I'm writing a custom membership provider.. I've set up a class that
inherets from MembershipProvier, and all of the override methods have
been started.. but for instanace in the EnabledPasswordReset method, I
want the return value to be read from the config section
enablePasswordReset..

I see dozens of examples explaining how to read from the appSettings
section, or ConnectionString settings.. but zero examples pulling
values from the membership section in C#. I'd rather have these values
in the xml file rather than returning the value in the class methods
directly.

For instance: my membership section looks like this

<configuration> .. <system.web> ..
<membership defaultProvider="MembershipProvider">
<providers>
<add connectionStringName="ConnectionString"
applicationName="secure2"
enablePasswordReset="false" ****
passwordFormat="Hashed"
minRequiredPasswordLength="5"
minRequiredNonalphanumericCharacters="0"
name="MembershipProvider"
type="secure.auth._auth"
requiresQuestionAndAnswer="false"
requiresUniqueEmail="true" />
</providers>
</membership>
... </system.web> ..</configuration>

And in secure.auth._auth, the other ride methods reside.. here is one:

public override bool EnablePasswordReset
{
get { throw new Exception("The method or operation is not
implemented."); }
}

I'd like this method to return "false" in this case, because the method
reads the line in the config snippet from above where the **** are
located.

.



Relevant Pages

  • Re: MembershipProvider limit no effect.
    ... Dose we need implement these features in my custom Membership provider or ... Juan T. Llibre, asp.net MVP ... or password answer of a membership user. ...
    (microsoft.public.dotnet.framework.aspnet)
  • 2.0 Custom Membership Provider!
    ... I am in the process of creating a custom membership provider: ... Is their someway i can adjust the CreateUser member signature? ... username, string password, string email, string passwordQuestion, string ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Oracle membership ?
    ... "We created a custom membership provider implementation for Oracle. ...
    (microsoft.public.dotnet.framework.aspnet)
  • MembershipUser object...
    ... Im trying to write a custom membership provider but in the GetUser method it ... Dim _user As New System.Web.Security.MembershipUser(Me.ApplicationName, ...
    (microsoft.public.dotnet.framework.aspnet)