C
Chizl
I can read .config files all day, but for some reason I cant write to them..
After searching for a few days, there are some that have code showing to
write, but none of them seem to work. Someone explain to me what could be
the problem?
I'm admin of the machine, I'm writting local, and this is the code I've
tried..
Way #1
--------------
Configuration config;
config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings[strKey].Value = strValue; //error, Object
reference not set to an instance of an object
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
Way #2
After searching for a few days, there are some that have code showing to
write, but none of them seem to work. Someone explain to me what could be
the problem?
I'm admin of the machine, I'm writting local, and this is the code I've
tried..
Way #1
--------------
Configuration config;
config =
ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings[strKey].Value = strValue; //error, Object
reference not set to an instance of an object
config.Save(ConfigurationSaveMode.Modified);
ConfigurationManager.RefreshSection("appSettings");
Way #2