So I was looking at the solution here to figure out how to do it. And, it works for when I run my project multiple times. However, from my understanding, the save only occurs when the project closes. What I would like to do is to save it when I need to during my code, so that during the same run time, I can accessed the previously saved files. Does anybody know how to approach this problem?
This is what I'm using to save my app settings at run time:
Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
config.AppSettings.Settings["CurrentPromoId"].Value = promo_id.ToString();
config.AppSettings.Settings["Date"].Value = DateTime.Today.ToString("yyyyMMdd");
config.Save(ConfigurationSaveMode.Modified, true);
What about RefreshSection?
ConfigurationManager.RefreshSection("appSettings");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With