K
Kbalz
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.
<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.