|
本帖最后由 liaochen 于 2015-5-29 21:59 编辑
HttpHelper http = new HttpHelper();
HttpItem item = null;
HttpResult result = new HttpResult();
string strCookie = string.Empty;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e) //登陆
{
item = new HttpItem()
{
URL = "http://www.sbanzu.com/checkuser.asp",
Method = "post",
Postdata = string.Format(@"Parameter Name=Value&UserName=快乐的可乐瓶&Password=19820509&code={0}&URl=/", textBox1.Text),
Cookie = strCookie,
};
result = http.GetHtml(item);
strCookie = result.Cookie;
outobj(result.Html);
}
private void pictureBox1_Click(object sender, EventArgs e) //显示验证码
{
item = new HttpItem()
{
URL = "http://www.sbanzu.com/sbanzu/GetCode.asp?r",
Method = "get",
ResultType = ResultType.Byte,
};
result = http.GetHtml(item);
strCookie = result.Cookie;
if (result.StatusCode == System.Net.HttpStatusCode.OK)
{
string statusCodeDescription = result.StatusDescription;
MemoryStream ms = new MemoryStream(result.ResultByte);
Image img = Image.FromStream(ms);
pictureBox1.Image = img;
}
}
private void outobj(string strhtml) //显示出来
{
richTextBox1.Clear();
richTextBox1.AppendText(strhtml);
webBrowser1.ScriptErrorsSuppressed = true;
webBrowser1.DocumentText = strhtml;
}
www.sbanzu.com
用户名:快乐的可乐瓶
密码:19820509
帮我看看吧,搞几天了,人都要疯了总是登陆不了
|
|