/// <summary> /// 更新ConfigBean /// </summary> /// <param name="name"></param> /// <param name="request"></param> /// <param name="serializer"></param> /// <returns></returns> private IReader UpdateConfigBean(ConfigBeanBase configBean, HttpRequest request) { var msg = new CBMessage(); if (!PermissionValidate.Instance.CheckChangePermission()) { if (HostingEnvironment.IsHosted && HttpContext.Current != null) { HttpContext.Current.Response.Redirect(HostingEnvironment.ApplicationVirtualPath); } else { msg.Message = "Sorry,Your IP Address " + IPHelper.GetClientIP() + " Doesn't Have Write Permission."; msg.IsSuccess = false; } } else if (configBean != null) { if (request.HttpMethod.ToLowerInvariant() == "get") { foreach (var k in request.QueryString.AllKeys.Where(a => paramsField.IndexOf(a.ToLowerInvariant()) == -1).OfType<string>()) { var oldVal = configBean.Get(k); var newVal = HttpUtility.HtmlDecode(HttpUtility.UrlDecode(request.QueryString[k])); ChangeLog.Write(ContextHelper.GetCategory(), string.Format("{0}的{1}值被更新 Old Value :{2} New Value :{3}", configBean.GetType().Name, k, oldVal, newVal)); configBean.Set(k, newVal); } } else { foreach (var k in request.Form.AllKeys.Where(a => paramsField.IndexOf(a.ToLowerInvariant()) == -1).OfType<string>()) { var oldVal = configBean.Get(k); var newVal = HttpUtility.HtmlDecode(request.Form[k]); configBean.Set(k, newVal); ChangeLog.Write(ContextHelper.GetCategory(), string.Format("{0}的{1}值被更新 Old Value :{2} New Value :{3}", configBean.GetType().Name, k, oldVal, newVal)); } } msg.Message = "Success"; msg.IsSuccess = true; } return msg; }