Hi
My web.config file hase the following information. I would like to reterive the "membership" section as a namevaluecollection .
<membership defaultProvider="MyCustomMembershipProvider">
<providers>
<add name="MyCustomMembershipProvider"
type="MyCustomMembershipProvider"
requiresQuestionAndAnswer="true"
enablePasswordRetrieval="true"
enablePasswordReset="true"
applicationName="CustomMembershipApplication"
requiresUniqueEmail="true"
passwordFormat="Encrypted"
maxInvalidPasswordAttempts="3"
passwordAttemptWindow="10"
MinRequiredPasswordLength="7"
connectionStringName="sqlConnection"/>
</providers>
</membership>
I tried the following options to get a NameValeCollection
SYStem.Configuration.ConfigurationSettings.GetConfig('membership')
System.Configuration.ConfigurationManager.GetSection("membership")
None worked fine. All the time I am getting Nothing from the result.
Please help me here.
Thanks
Nitu

How do i get the namevaluecollection from the web.config?
Stephen S.
Hi Aquilax
Thanks for the reply.
Your suggestion return as MembershipSection type. I was tryig to cast it to NamevalueCollection & getting an error
"Unabe to cast object of type 'System.Web.Configuration.MembershipSection' to type System.Collections.Specialized.NameValueCollection."
Please let me know
Thanks
Nitu
Donal McWeeney
Hi!
Is there a reason you're not using the Membership. API's They will give you the values of all of those configuration setttings. For example Membership.MinRequiredPasswordLength.
The best place for asking ASP.NET questions is on the ASP.NET community site, and in the forums there. Check out
http://www.asp.net/welcome.aspx tabindex=1&tabid=39.HTH,
PEte
John Cole
MembershipSection section = (MembershipSection)System.Configuration.ConfigurationManager.GetSection("system.web/membership");
iiiwabibitoiii
"Is there a reason you're not using the Membership. API's "
Probably because he is doing a custom membership provider