c#当中如何去模拟这样的一个post进行传参啊!通过这样来获取相关页面的信息!
<formname="frmpage"method="POST"action="searchresult1.jsp"><ahref="javascript:gopage(...
<form name="frmpage" method="POST" action="searchresult1.jsp">
<a href="javascript:gopage(2);">下一页</a> <a href="javascript:gopage(5);">最末页</a>
</td>
</tr>
<tr>
<td align="right" width="98%">
<input type="hidden" name="count" value="99">
<input type="hidden" name="talent_type" value="">
<input type="hidden" name="work_mode" value="">
<input type="hidden" name="industry" value="">
<input type="hidden" name="apply_func" value="0101">
<input type="hidden" name="work_loc1" value="0106">
<input type="hidden" name="pub_date" value="7">
<input type="hidden" name="keyword" value="">
<input type="hidden" name="flag" value="">
共<font color="ff6600"> 99 </font>条,<font color="ff6600">
5 </font>页, 去第 展开
<a href="javascript:gopage(2);">下一页</a> <a href="javascript:gopage(5);">最末页</a>
</td>
</tr>
<tr>
<td align="right" width="98%">
<input type="hidden" name="count" value="99">
<input type="hidden" name="talent_type" value="">
<input type="hidden" name="work_mode" value="">
<input type="hidden" name="industry" value="">
<input type="hidden" name="apply_func" value="0101">
<input type="hidden" name="work_loc1" value="0106">
<input type="hidden" name="pub_date" value="7">
<input type="hidden" name="keyword" value="">
<input type="hidden" name="flag" value="">
共<font color="ff6600"> 99 </font>条,<font color="ff6600">
5 </font>页, 去第 展开
2个回答
展开全部
using System.Net;
Uri uri = new Uri("http://*******/searchresult1.jsp");
try
{
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
req.Method = "post";
string reqdata = "count=99&talent_type=&work_mode=&industry=&apply_func=0101&work_loc1=0106&pub_date=7&keyword=&flag=";
//req.Referer = "blog.sina.com.cn";
byte[] buf=System.Text.Encoding.GetEncoding("utf-8").GetBytes(reqdata);
System.IO.Stream s = req.GetRequestStream();
s.Write(buf, 0, buf.Length);
s.Close();
req.ContentLength = buf.Length;
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
string html = sr.ReadToEnd();//此处是源码
Console.Write(html);
sr.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Uri uri = new Uri("http://*******/searchresult1.jsp");
try
{
HttpWebRequest req = WebRequest.Create(uri) as HttpWebRequest;
req.Method = "post";
string reqdata = "count=99&talent_type=&work_mode=&industry=&apply_func=0101&work_loc1=0106&pub_date=7&keyword=&flag=";
//req.Referer = "blog.sina.com.cn";
byte[] buf=System.Text.Encoding.GetEncoding("utf-8").GetBytes(reqdata);
System.IO.Stream s = req.GetRequestStream();
s.Write(buf, 0, buf.Length);
s.Close();
req.ContentLength = buf.Length;
HttpWebResponse res = req.GetResponse() as HttpWebResponse;
StreamReader sr = new StreamReader(res.GetResponseStream(), System.Text.Encoding.Default);
string html = sr.ReadToEnd();//此处是源码
Console.Write(html);
sr.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
展开全部
你看一下webclient类吧 模拟表单的提交 http://www.cnblogs.com/anjou/archive/2006/12/25/602943.html (asp.net中webClient填充和提交表单的方法!)
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询