I am having some trouble opening a custom config section in my web.config file.
Here is web.config:
<configuration>
<configSections>
<section name="ldapConfiguration" type="GTCC.Ldap.LdapConfiguration,GTCCLdap"/>
</configSections>
<ldapConfiguration PrimaryServer="1.2.3.4" SecondaryServer="5.6.7.6" Port="636" CertPath="c:\mycert.cer" AdminUsername="admin" AdminPassword="adminpass"/>
</configuration>
Here is code to get the section:
var config = WebConfigurationManager.OpenWebConfiguration("/");
var ldapConfig = (LdapConfiguration)config.GetSection("ldapConfiguration");
Here is the contents of config.Sections.Keys:
system.data
windows
system.webServer
mscorlib
system.data.oledb
system.data.oracleclient
system.data.sqlclient
configProtectedData
satelliteassemblies
system.data.dataset
startup
system.data.odbc
system.diagnostics
runtime
system.codedom
system.runtime.remoting
connectionStrings
assemblyBinding
appSettings
system.windows.forms
Why isn’t my section showing up in the keys?
EDIT
Error: Exception has been thrown by the target of an invocation
I changed my code that gets the configuration object: