Hi all,
I'm trying to fetch some settings from my membership provider in my asp.net application (so that I don't have to duplicate the information in the appSettings section) but I am getting the following exception:
System.Configuration.ConfigurationErrorsException: The entry 'MyMembershipProvider' has already been added. (C:\Inetpub\intranet-webapp\web.config line 53)
My code is the following:
var configurationManager = WebConfigurationManager.OpenWebConfiguration("/", "IntranetWebapp");
var section = (MembershipSection) configurationManager.GetSection("system.web/membership");
The exception is raised in the second line. I find it completely bizarre, since I am not trying to add any new information to the config file. Instead I'm just trying to retrieve it.
The contents of my config section:
<membership defaultProvider="IntranetApp">
<providers>
<add applicationName="IntranetApp"
enableSearchMethods="true"
connectionStringName="IntranetConnectionString"
connectionUsername="CN=username,OU=Service Accounts,OU=Users,OU=CompanyName,DC=CompanyName,DC=com"
connectionPassword="********"
name="MyIntranetMembershipProvider"
type="System.Web.Security.ActiveDirectoryMembershipProvider" />
</providers>
</membership>
Any help is much appreciated.
Pablo