public ActionResult PortDetail(FormCollection collect, string url, string PortsType, Guid id) { Guid modularid = Guid.Empty; var Ports = _IPortsService.GetAllEnt().FirstOrDefault(t => t.Id == id); if (Ports != null) { modularid = Ports.ModularID; } var head_List = _iheaderService.GetAllEnt().Where(t => t.ModularID == modularid); NameValueCollection nameValue = new NameValueCollection(); NameValueCollection headList = new NameValueCollection(); foreach (var key in collect.AllKeys) { if (key == "url" || key == "PortsType" || key == "id" || key == "X-Requested-With") { continue; } var head = head_List.FirstOrDefault(t => t.HeaderCode == key); if (head != null) { headList.Add(key, collect.GetValue(key).AttemptedValue); continue; } nameValue.Add(key, collect.GetValue(key).AttemptedValue); } string message = WebUtility.Request(url, PortsType, nameValue, headList); //操作json数据 res = message; return(RedirectToAction("Result")); }