- 积分
- 40165
- 好友
- 记录
- 主题
- 帖子
- 听众
- 收听
|
发表于 2013-4-12 13:54:20
|
显示全部楼层
Form代码
[code=csharp]using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace cookieLogin
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
HttpHelper http = new HttpHelper();
HttpItem Hitem = new HttpItem()
{
URL = "http://www.zdljw.cn/getcode.asp"
};
pictureBox1.Image = http.GetImg(Hitem);
//textBox3.Text = Hitem.Cookie;
}
private void button1_Click(object sender, EventArgs e)
{
HttpHelper http = new HttpHelper();
HttpItem Hitem = new HttpItem()
{
URL = "http://www.zdljw.cn/chklogin.asp",
ContentType = "application/x-www-form-urlencoded",
Accept = "text/html",
Method = "POST",
Postdata = "title=CCYoud&leibie=2&Email=baidu007%40qq.com&qq=56454&url=http%3a%2f%2fwww.baidu.com&logo=&memo=5215454sd&action=add_wz&mofei=" + textBox2.Text,
//Cookie = textBox3.Text
};
string strHtmel = http.GetHtml(Hitem);
textBox1.Text = strHtmel;
if (strHtmel.IndexOf("window.location='index.php'") > -1)
{
MessageBox.Show("登录成功");
}
else
{
MessageBox.Show("登录失败");
}
}
private void button2_Click(object sender, EventArgs e)
{
}
}
}
[/code]
mydecms
[code=csharp]using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
namespace cookieLogin
{
public static class MydeCms
{
public static CookieContainer CookiesList = new CookieContainer();
}
}
[/code]
楼主要干什么没看明白,是要实现登录功能,还是要登录之前要格式化一下Cookie呢 |
|