Retrieving settings from Web.config

  • Thread starter Thread starter Dave
  • Start date Start date
D

Dave

Hello.
I want to create some custom settings in my Web.config file and then
retrieve it in my application, exactly I want to store some connection
string for my database.
I'm adding these sections to my Web.config file:

====================================================
<!-- Define handlers of the custom settings for my application -->
<configSections>
<sectionGroup name="myApp.settings">
<section
name="msSqlSettings"
type="System.Configuration.NameValueFileSectionHandler, System"
/>
</sectionGroup>
</configSections>

<!-- Define sections of the custom settings for my application -->
<myApp.settings>
<msSqlSettings>
<add
key="ConnectionString"
value="Some Connection String"
/>
</nySqlSettings>
</myApp.settings>
====================================================

Now how can I retrieve this connation string value in my application (C#)?
And one more question please:
What for is type="System.Configuration.NameValueFileSectionHandler, System"?
 
Back
Top