无法模拟post数据
本帖最后由 a19895161989516 于 2014-04-14 18:20:16 编辑
http://www.phil-jobnet.dole.gov.ph/Hot.aspx
这个是我要抓取数据的页面,我想实现翻页,这个翻页是个post动作,但我模拟post 一直跳到错误页
string ctl00_ToolkitScriptManager1_HiddenField = string.Empty;
string regex = "<script src=\"CombineScriptsHandler.ashx\\?_TSM_HiddenField_=ctl00_ToolkitScriptManager1_HiddenField&_TSM_CombinedScripts_=([^\"]+)\" type=\"text/javascript\"></script>";
MatchCollection regexMatches = Regex.Matches(sHtml, regex, RegexOptions.Singleline | RegexOptions.IgnoreCase);
if (regexMatches != null && regexMatches.Count > 0)
{
ctl00_ToolkitScriptManager1_HiddenField = regexMatches[0].Groups[1].Value.Trim();
ctl00_ToolkitScriptManager1_HiddenField = System.Web.HttpUtility.UrlDecode(ctl00_ToolkitScriptManager1_HiddenField);
}
string postdata = "ctl00$ToolkitScriptManager1=" + "ctl00$RightContents$upPnl1|ctl00$RightContents$Pager2$dlPages"+Environment.NewLine
+ "&ctl00_ToolkitScriptManager1_HiddenField=" + ctl00_ToolkitScriptManager1_HiddenField + Environment.NewLine
+ "&ctl00_RightContents_TabContainer1_ClientState=" + getcontroldata("ctl00_RightContents_TabContainer1_ClientState") + Environment.NewLine
+ "&ctl00$RightContents$Pager2$dlPages=" + (iPageNo - 1).ToString() + Environment.NewLine
+ "&ctl00$RightContents$Pager2$hfCurrentPage=1" + Environment.NewLine
+ "&ctl00$RightContents$Pager2$hfPageSize=10" + Environment.NewLine
+ "&ctl00$RightContents$Pager2$hfRowCount=" + getcontroldata("ctl00_RightContents_Pager2_hfRowCount") + Environment.NewLine
&nbs