By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,112 Members | 1,584 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,112 IT Pros & Developers. It's quick & easy.

want to display sections automatically in ConfigSection in web.config

P: n/a
Hi

Well i tell you the situation ,

i am having the configsection settings like below.
what i need to do is to display the sections automatically when i add
new section name.
after this the all section settings coresponding to section name will
be displayed.

I am able to display the section settings by statically giving it name
in my code behind ,

right now i am using the section name statically as

"Settings-en-gb" ,but i need to display all the sections automatically.
Like it pickup the section name one by one and shows its corresponding
settings.
just tell me how i can track all section name counts and there names.
***********************Code i am using to Display****************

Dim MyNameValueCollection As Specialized.NameValueCollection

MyNameValueCollection =
ConfigurationSettings.GetConfig("Settings-en-gb")

Dim test(MyNameValueCollection.Count) As String

If MyNameValueCollection.Count > 0 Then
test = MyNameValueCollection.AllKeys
End If
Dim i As Integer
Dim table As String

table = "<Table border=1>"
For i = 0 To MyNameValueCollection.Count - 1

table = table + "<tr><td>" + test(i) + " </td><td>" +
MyNameValueCollection(test(i)) + "</td></tr>"

Next
table = table + "</table>"
Label1.Text = table


*****************My Web.Config Settings*************************

<configSections>

<section name="Settings-en-gb"
type="System.Configuration.NameValueSectionHandler ,system,Version=1.0.3300.*0,
Culture=neutral, PublicKeyToken=b77a5c561934e089,Custom=null" />

<section name="Settings-en-in"
type="System.Configuration.NameValueSectionHandler ,system,Version=1.0.3300.*0,
Culture=neutral, PublicKeyToken=b77a5c561934e089,Custom=null" />

</configSections>

<Settings-en-gb>
<add key="ROOT_DIRECTORY" value="" />
<add key="EXT_TO_INCLUDE" value="*.aspx" />
<add key="FILENAME_TO_EXCLUDE" value="ABC.ASPX" />
<add key="DIRECTORYNAME_TO_EXCLUDE" value="Utilities" />
<add key="XML_FILENAME" value="SITEMAP-EN-GB.XML" />
<add key="XML_FILE_PATH" value="C:\" />
<add key="URL_PREFIX" value="http://visitbritain.com/vb3- en-gb/" />

<add key="DEFAULT_CHANGE_FREQUENCY" value="always" />
<add key="DEFAULT_PRIORITY" value="0.8" />

</Settings-en-gb>
<Settings-en-in>

<add key="ROOT_DIRECTORY" value="" />
<add key="EXT_TO_INCLUDE" value="*.aspx" />
<add key="FILENAME_TO_EXCLUDE" value="ABC.ASPX" />
<add key="DIRECTORYNAME_TO_EXCLUDE" value="Utilities" />
<add key="XML_FILENAME" value="SITEMAP-EN-GB.XML" />
<add key="XML_FILE_PATH" value="C:\" />
<add key="URL_PREFIX" value="http://visitbritain.com/vb3-en-gb/" />
<add key="DEFAULT_CHANGE_FREQUENCY" value="always" />
<add key="DEFAULT_PRIORITY" value="0.8" />

</Settings-en-in>

Sep 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.