private void SaveWebConfig(string nextPath) { try { if (CheckValidation()) { //加载web.config文件 XmlDocument webconfigDoc = new XmlDocument(); webconfigDoc.Load(_WebConfigFilePath); ConnectStringView1.SetConnectString(webconfigDoc); ClassFactoryView1.SetClassFactory(webconfigDoc); SubSystemSetView1.SetSubSystemSet(webconfigDoc); MailSettingView1.SetMailSetting(webconfigDoc); SMSSettingView1.SetSMSSetting(webconfigDoc); ContactSettingView1.SetContactSetting(webconfigDoc); OtherWebConfig1.SetOtherWebConfig(webconfigDoc); AttendanceSettingView1.SetAttendanceSetting(webconfigDoc); //保存设置 webconfigDoc.Save(_WebConfigFilePath); Message = "保存成功"; Response.Redirect(nextPath); } else { Message = "保存失败"; } } catch { Message = "保存失败"; } }
protected void btnSave_Click(object sender, EventArgs e) { if (CheckValidation()) { XmlDocument webconfigDoc = new XmlDocument(); webconfigDoc.Load(_FilePath); ConnectStringView1.SetConnectString(webconfigDoc); ClassFactoryView1.SetClassFactory(webconfigDoc); AutoRemindFunctionSetView1.SetFunctionSetting(webconfigDoc); MailSettingView1.SetMailSetting(webconfigDoc); AttendanceSettingView1.SetAttendanceSetting(webconfigDoc); //保存设置 webconfigDoc.Save(_FilePath); Message = "保存成功"; NextPage(); } else { Message = "保存失败"; } }