博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
aaa
阅读量:6593 次
发布时间:2019-06-24

本文共 3638 字,大约阅读时间需要 12 分钟。

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);                List
lstDev = 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; }

 

转载于:https://www.cnblogs.com/LiMin/archive/2013/04/03/2997170.html

你可能感兴趣的文章
[转] 用GDB调试程序(五)
查看>>
OCM_第十一天课程:Section5 —》数据仓库
查看>>
水晶报表
查看>>
kettle-多文件合并
查看>>
MyEclipse6.5的反编译插件的安装
查看>>
Jenkins + Ansible + Gitlab之ansible篇
查看>>
cogs 539. 牛棚的灯
查看>>
SQL SERVER 备份数据库到指定路径语句
查看>>
3.Knockout.Js(属性绑定)
查看>>
v140平台工具集与v110工具集选择
查看>>
EF6+Sqlite连接字符串的动态设置
查看>>
下拉加载更多
查看>>
您是哪一种类型的老板?
查看>>
SQL SERVER 2012 只能识别20个CPU的问题
查看>>
设计模式(十)外观模式
查看>>
C/C++语言中Static的作用详述
查看>>
[Android Samples视频系列之ApiDemos] App-Activity-Recreate
查看>>
ASP开发基础
查看>>
MYSQL性能调优
查看>>
LVM自动扩容
查看>>