Here is the code I'm using:

```
private void SaveConfiguration()
{
    if (txtUsername.Text != "" && txtPassword.Text != "")
    {
        ConfigurationManager.AppSettings["Username"] = txtUsername.Text;
        ConfigurationManager.AppSettings["Password"] = txtPassword.Text;

        MessageBox.Show("Su configuracion guardo exitosamente.", "Exito!");
        this.Close();
    }
    else
    {
        MessageBox.Show("Por favor lleno los campos.", "Error.");
    }
}

```

Now, the settings are persisted but when I close the application and press F5 to run it again, the values are reverted to what is typed into the app.config file. Any suggestions?