Ejemplo n.º 1
0
        private void btn_save_Click(object sender, EventArgs e)
        {
            string userName = tb_userName.Text;
            string password = Crypting.EncryptSecret(tb_password.Text);

            Configuration configuration = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            configuration.AppSettings.Settings["UserName"].Value = userName;
            configuration.AppSettings.Settings["Password"].Value = password;
            configuration.Save(ConfigurationSaveMode.Full, true);
            ConfigurationManager.RefreshSection("appSettings");

            this.Close();
        }