Need ConfigurationManager example code

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Mark Ingram

    #1

    Need ConfigurationManager example code

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

    Configuration config =
    ConfigurationMa nager.OpenExeCo nfiguration(Con figurationUserL evel.PerUserRoa mingAndLocal);

    config.AppSetti ngs.Settings.Ad d("KeyTest", "KeyValue") ;
    //config.SaveAs(c onfig.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>\L ocal
    Settings\Applic ation
    Data\<app>\<app >.vshost.exe_Ur l_aif3rzcpslr4l tlzn5wf5dznoaxb caxf\1.0.0.0\us er.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
Working...