c# - Not able to persist new changes in appsetting section in app.config WPF? -


below code using update or change values in appsetting in app.config

 configuration config = configurationmanager.openexeconfiguration(configurationuserlevel.none);                config.appsettings.settings["username"].value = username;  config.appsettings.settings["pwd"].value = pwd;  config.save(configurationsavemode.modified, true);                  configurationmanager.refreshsection("appsettings"); 

i using above code change or update settings in appsetting section @ runtime , want changes persist when run application should pick new values appsettings here doesn't happen changes made , saved @ run time not persist when relaunch application again has old default settings. checked app.config in bin/debug had old values in appsettings. refered various blogs , post here reference got same code above did not persist settings.have referred post

i had same problem while ago. have preferred put in comment don't have privilege. answer might not case think worth shared.

may ask bin folder located? windows 7 when programmatically alter file isn't in user accessible space creates copy of file in roaming space , there file stay. every time try access file (like app.config) w7 transparently redirect readings/writings file, there's chance modifying file in roaming space, leaving 1 lookin unaltered.

are changes making still there successive time start application?

disclaimer/apology: i'm not experienced user if saying silly things let me know , remove comment.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -