Re: App.Config file
- From: "Stephen" <stephen_jn@xxxxxxxxxxx>
- Date: Tue, 17 Jan 2006 16:31:55 -0700
Yes it does,
Thanks a lot
Stephen
"KJ" <n_o_s_p_a__m@xxxxxxxx> wrote in message
news:1137539048.647196.246320@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> I can't answer for ASP.NET 2.0. But for ASP.NET 1.1, you can define
> custom sections in the config file, then, pass in the custom section
> name to your method, and pluck the value from the appropriate section.
>
> So, your web.config might look like this (definition of the custom
> sections, followed by custom sections):
>
> <configuration>
> <configSections>
> <section
> name="dev" type="System.Configuration.NameValueFileSectionHandler,
> System, Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089"/>
> <section
> name="stage" type="System.Configuration.NameValueFileSectionHandler,
> System, Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089"/>
> <section
> name="prod" type="System.Configuration.NameValueFileSectionHandler,
> System, Version=1.0.5000.0, Culture=neutral,
> PublicKeyToken=b77a5c561934e089"/>
> </configSections>
>
> <dev>
> <add key="AppRootDir" value="/Authoring/"/>
> </dev>
>
> <stage>
> <add key="AppRootDir" value="/S-Authoring/"/>
> </stage>
>
> <prod>
> <add key="AppRootDir" value="/P-Authoring/"/>
> </prod>
> </configuration>
>
> Then, write a class that retrives the values by section, using a call
> such as:
>
> NameValueCollection nvc =
> (NameValueCollection)ConfigurationSettings.GetConfig("dev");
>
> -- then return the value you want:
>
> string AppRootDir = nvc["AppRootDir"]; //returns "/Authoring/"
>
> -Hope this helps
>
.
- References:
- App.Config file
- From: Stephen
- Re: App.Config file
- From: KJ
- App.Config file
- Prev by Date: Instantiate TableAdapter at Runtime
- Next by Date: Re: App.Config file
- Previous by thread: Re: App.Config file
- Next by thread: Re: App.Config file
- Index(es):
Relevant Pages
|