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 Page_Load(object sender, EventArgs e) { //加载web.config文件 if (!Page.IsPostBack) { XmlDocument webconfigDoc = new XmlDocument(); webconfigDoc.Load(_WebConfigFilePath); ConnectStringView1.GetConnectString(webconfigDoc); ClassFactoryView1.GetClassFactory(webconfigDoc); SubSystemSetView1.GetSubSystemSet(webconfigDoc); MailSettingView1.GetMailSetting(webconfigDoc); SMSSettingView1.GetSMSSetting(webconfigDoc); ContactSettingView1.GetContactSetting(webconfigDoc); OtherWebConfig1.GetOtherWebConfig(webconfigDoc); AttendanceSettingView1.GetAttendanceSetting(webconfigDoc); Message = ""; } }