private string SendWebCms(WebCmsSendModel webCmsSendModel) { var webCmsAddress = WebConfigurationManager.AppSettings["WebCmsAddress"]; var values = GetSendContent(webCmsSendModel); var httpParam = new HttpParam() { IsUseBase = false, Method = Common.Http.HttpMethod.POST, Content = new StringContent(values.Select(value => $"{value.Key}={value.Value}").JoinString("&"), System.Text.Encoding.GetEncoding("GB2312")), Url = webCmsAddress, Type = ContentType.FORM_DATA }; var httpClient = new HttpClient(); httpClient.DefaultRequestHeaders.Add("Authorization", Request.Url.Authority.GetMd5Str()); return(HttpRequest.Send(httpParam, httpClient: httpClient)); }
private IEnumerable <KeyValuePair <string, string> > GetSendContent(WebCmsSendModel webCmsSendModel) { var values = new[] { new KeyValuePair <string, string>("oldTempName", webCmsSendModel.OldTempName ?? string.Empty), new KeyValuePair <string, string>("tempName", webCmsSendModel.TempName ?? string.Empty), new KeyValuePair <string, string>("tempType", webCmsSendModel.TempType ?? string.Empty), new KeyValuePair <string, string>("siteName", webCmsSendModel.SiteName ?? string.Empty), new KeyValuePair <string, string>("cmd", webCmsSendModel.Cmd ?? string.Empty), new KeyValuePair <string, string>("content", webCmsSendModel.Content ?? string.Empty), new KeyValuePair <string, string>("option", webCmsSendModel.Option ?? string.Empty), new KeyValuePair <string, string>("resource", webCmsSendModel.Resource ?? string.Empty), new KeyValuePair <string, string>("icon", webCmsSendModel.Icon ?? string.Empty) }; return(values); }