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

Need ConfigurationManager example code

P: n/a
Hi all, having a real struggle using the ConfigurationManager class, i
want to be able to save user specific information to the configuration
file, i try to use:

Configuration config =
ConfigurationManager.OpenExeConfiguration(Configur ationUserLevel.PerUserRoamingAndLocal);

config.AppSettings.Settings.Add("KeyTest", "KeyValue");
//config.SaveAs(config.FilePath);
config.Save();

But it crashes because the config.FilePath doesnt exist (neither does
the directory that the file is supposedly in).

(The config.FilePath = C:\Documents and Settings\<me>\Local
Settings\Application
Data\<app>\<app>.vshost.exe_Url_aif3rzcpslr4ltlzn5 wf5dznoaxbcaxf\1.0.0.0\user.config)


What im trying to do is save application specific data (such as server
to connect to) in the application directory, then user specific data
such as window colours in the application data folders.

How can i do this?

Thanks,

Mark
Jan 16 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.