Steve Hougom
asked on
Help with accessing a section of web.config for db conn
I have a section of my web.config im trying to use as a database connection string.
Im just trying to do this in the following way but am having trouble accessing the value in the web config where the connection string is.
Im not sure if I use ConfigurationManager.GetSe ction or what i need to use to get to the connection string.
The csportal section is in a custom section it does not exist in <appSettings> or <connectionStrings> sections.
Im just trying to do this in the following way but am having trouble accessing the value in the web config where the connection string is.
SqlConnection conn = new SqlConnection();
conn.connectionstring = ?
Here is the section in the web.config im trying to access. <section name="csrportal" type="System.Configuration.DictionarySectionHandler, System"/>
<csportal>
<add key="RTICustomerConnectionString" value="server=(local);Integrated Security=SSPI;database=dbname;Application Name=appname"/>
Im not sure if I use ConfigurationManager.GetSe
The csportal section is in a custom section it does not exist in <appSettings> or <connectionStrings> sections.
Hopefully this will help; http://mike-ward.net/blog/post/00830/creating-custom-configuration-sections-in-web-config
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It turned out the solution was something a little different than I expected.