Mark
Sat Jan 14 05:34:36 CST 2006
Yeah, i was hoping i would be able to just open up 2 lots of
ConfigurationManager instances, 1 to retrieve from Application Data folder
and one to retrieve from the .exe folder.
How do you handle the first run? Do you have to attempt to read the values,
if they dont exist write them out, or is there a system for setting default
values? (ie similar to using the registry, when retrieving keys there is the
option to specify a default value if the key was empty).
Thanks,
Mark
"NuTcAsE" <rao.ritesh@gmail.com> wrote in message
news:1137184391.412734.21330@g44g2000cwa.googlegroups.com...
> If the configuration data is per-user specific then saving it to the
> same directory as the .exe file (even if installed on a network) is a
> bad choise. User-specific data should be stored under the Documents and
> Settings\[User]\Application Data folder, while application specific
> data should be under the application's installation directory.
>
> To answer your question yes ConfigurationManager (I am assuming this is
> a .Net 2.0 question) can do this.
> ConfigurationManager.OpenExeConfiguration method takes in a
> ConfigurationUserLevel enum that specifies the whether to retrieve per
> user configuration or per application. Below is the sample code:
>
> Configuration config = ConfigurationManager.OpenExeConfiguration
> (ConfigurationUserLevel.PerUserRoaming);
> //use config to read / write configuration data
>
> See
>
http://msdn2.microsoft.com/en-us/library/system.configuration.configurationuserlevel.aspx
> for more information.
>
> Hope this helps...
>
> NuTcAsE
>