Retrieving settings from Web.config

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"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top