public bool Post(Action callBack) { if (Task != null) { var config=ConfigurationManager.Instance.CRLRobotConfig; var url = config.GlobalSetting.ServerConfig.ServerUrl + Setting.PostUrl; var _credentialCache = CredentialCache.DefaultNetworkCredentials; var addRess = string.Format(url, Task.ID, Task.CRLNo); ListlstDev = GetPMDev_Tester(Task.CRLNo); GetQACRLType();//获取状态 if (lstDev == null || lstDev.Count <= 0 || (!Task.IsActive)) { if (string.IsNullOrEmpty(Task.HandResult)) { Task.HandResult = " Has No Develpoer and Tester"; } return false; } HttpWebRequest hp = (HttpWebRequest)HttpWebRequest.Create(addRess); hp.Credentials = _credentialCache; hp.CookieContainer = new CookieContainer(); var responseStr = (HttpWebResponse)hp.GetResponse(); var _cookies = responseStr.Cookies; var strStream = responseStr.GetResponseStream(); StreamReader sr = new StreamReader(strStream); var responseHtml = sr.ReadToEnd(); string html = responseHtml; //var viewState = Regex.Match(html, @"(?is) [^""]+)"" />").Groups["value"].Value; //var valadation = Regex.Match(html, @"(?is) [^""]+)"" />").Groups["value"].Value; var viewState = Regex.Match(html, "(?is) [^\"]+)\" />").Groups["value"].Value; //var valadation = Regex.Match(html, @"(?is) [^""]+)"" />").Groups["value"].Value; GetPostParameter(); switch (Task.FormType) { case CRLFormType.CRLDevelopersCoding: string ddlLocalDbaStr = Regex.Match(html, "(?is)( )").ToString(); string ddlCodeStandardStr = Regex.Match(html, "(?is)( )").ToString(); var ddlLocalDba = Regex.Match(ddlLocalDbaStr, "(?is)( )").Groups["value"].Value; NameValueCollection["_ctl0:ucDeveloperCoding:_ctl3:ddlLocalDba"] = ddlLocalDba; var ddlCodeStandard = Regex.Match(ddlCodeStandardStr, "(?is)( )").Groups["value"].Value; NameValueCollection["_ctl0:ucDeveloperCoding:_ctl3:ddlCodeStandard"] = ddlCodeStandard; break; default: break; } NameValueCollection["__VIEWSTATE"] = viewState; HttpWebRequest htp_Request = (HttpWebRequest)HttpWebRequest.Create(addRess);// .Create(url) htp_Request.CookieContainer = hp.CookieContainer; htp_Request.UserAgent = hp.UserAgent; htp_Request.Accept = hp.Accept; htp_Request.KeepAlive = hp.KeepAlive; htp_Request.Credentials = hp.Credentials; try { HttpUploadHelper.Upload(htp_Request, FileCollects(), NameValueCollection); PostSuccess = true; } catch (Exception ex) { PostSuccess = false; LogManager.GetCurrentClassLogger().Info(ex.ToString()); } } return PostSuccess; }