KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to read the app.config value, show it in a message box, change the value using an external text editor, and finally show the updated value. I tried using the following code: private void button2_Click(object sender, EventArgs e) { Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); ConfigurationManager.RefreshSection("appSettings"); ConfigurationManager.RefreshSection(config.AppSettings.SectionInformation.Name); MessageBox.Show(ConfigurationManager.AppSettings["TheValue"]); } But it doesn't work. It shows the old value (before changing in external text editor). Any suggestions? <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="TheValue" value="abc"/> </appSettings> </configuration>
Tags (comma-separated)
Save Edits
Cancel