Web Config vs XML File

  • Thread starter Thread starter Stuart Ferguson
  • Start date Start date
S

Stuart Ferguson

I was wondering if anyone could explain to me the differences between a
standard XML file and the Web.Config file for storing application
settings.

Stuart
 
Nothing except the framework handles all the plumbing for the web.config.
They are both XML files.
 
...
I was wondering if anyone could explain to me the differences between a
standard XML file and the Web.Config file for storing application
settings.

Hi Stuart,

I dont claim by any accounts to be an expert, however a few things I am
aware of..

your web.config file IS an xml file
the .config extension enables the server to not display it to "punters"
browsing
you can customise it with your own key/value pair items
you can in addition use your own xml file for configuration information
(ontop of the web.config file)

I hope that helps a bit..

Regards

Rob
 
Yeah. Also if you store your application settings in web.config it is a
snap to pull them out using:

System.Configuration.ConfigurationSettings.AppSettings("mystuff")

or the new .NET 2.0's

System.Configuration.ConfigurationManager.AppSettings("mystuff")

Speaking of which, why do you have to add a reference to
System.configuration.dll if you want to use ConfigurationManager, but you
don't for just ConfigurationSettings.

Probably obvious, but I'm just not groking it.

Greg
 
Greetings,
I am wandering if someone could give me an insight on following...
I have custom settings in my web.config, such as:
<configSections>
<sectionGroup name="STApplication">
<sectionGroup name="WebUI">
<section name="BackLookup"
"System.Configuration.NameValueSectionHandler,System"/>
<section name="SearchInvoiceList" type=
"System.Configuration.NameValueSectionHandler,System"/>

with following values:
<!-- Custom Configuration Values -->
<STApplication>
<WebUI>
<BackLookup>
<add key="days" value="30"/>
</BackLookup>
<SearchInvoiceList>
<add key="List0" value="--- ALL ---"/>
<add key="List1" value="Client"/>
<add key="List2" value="Parter"/>
</SearchInvoiceList>
</WebUI>
</STApplication>
</sectionGroup>
</sectionGroup>
</configSections>

When I load a page,upon attempting to execute line:
WebConfigParams.NameValueCollection collSearchInvList =
(WebConfigParams.NameValueCollection) System.Configuration.ConfigurationSettings.GetConfig("STApplication/WebUI/SearchInvoiceList");
I get an exception:
Exception creating section handler.
Assembly Load Trace: The following information can be helpful to determine
why the assembly 'System' could not be loaded.

This is something new to me, failing to loading System assembly...Is there
anything related to rights/security...
Any insight would be appreciated.
Thanks
 

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

Back
Top