|
本帖最后由 新手来学习 于 2013-3-14 07:32 编辑
[code=csharp] private void login()
{
string username=System.Web.HttpUtility.UrlEncode(Encoding.GetEncoding("gb2312").GetBytes(txtuser.Text));//用户名中文编码问题
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://www.sufeinet.com/member.php?mod=logging&action=login",
Method="post",
Cookie = "",
Postdata = "fastloginfield=username&username="+username+"&password="+txtpass.Text+"&quickforward=yes&handlekey=ls",
ResultType = ResultType.Byte,
};
HttpResult result = http.GetHtml(item);
//第二次请求
item.URL = "http://www.sufeinet.com";
item.Method = "get";
item.Cookie = item.Cookie;
result = http.GetHtml(item);
string html = result.Html;
textBox1.Text = html;
}[/code]
登陆成功后,第二次请求打开首页,怎么没有登录呢?
按照你例子来写的.
|
|