对于使用c#,我还是个新手。现在我正在做一个关于自动登录网站并收集数据的应用程序!我已经搜索了一些关于这方面的信息,我知道首先我必须将我的帐户和密码发布到网站上。例如:
WebRequest req = WebRequest.Create(formUrl);
req.ContentType = "application/x-www-form-urlencoded";
req.Method = "POST";
byte[] bytes = Encoding.ASCII.GetBytes(formParams);
req.ContentLength = bytes.Length;
using (Stream os = req.GetRequestStream())
{
os.Write(bytes, 0, bytes.Length);
}
formUrl是我必须向其发送帐户和密码信息的url,而formParams是帐户和密码信息。现在的问题是:如何获取formUrl。
下面是我的一些网页html代码:
<form name="form1" method="post" action="/cn/LogForm.aspx" onsubmit="return CheckLogin(this);">
<input type="hidden" name="backurl" value="/cn/assistant.aspx"/>
<table width="262" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="60" height="30" align="center">用户名:</td>
<td width="130"><input name="Username" type="text" class="border-login" tabindex=1 /></td> "
我要登录的网站是"http://www.cantonfair.org.cn/cn/“
发布于 2011-06-21 16:42:38
使用FireBug,火狐插件,通过在火狐中打开页面来找到发布的网址。
发布于 2013-06-14 11:37:19
这不就是行动路径吗?还是我错过了什么?
action="/cn/LogForm.aspx"
formURL为http://www.cantonfair.org.cn/cn/LogForm.aspx
https://stackoverflow.com/questions/6422497
复制相似问题