|
楼主 |
发表于 2014-3-26 16:59:25
|
显示全部楼层
string postData =
string.Format(
"in_hi_space=Login&in_hi_spaceID=1&in_hi_control=Login&in_hi_dologin=true&custom_loginfo=00030002{0}0000000000hbW1TGvKO%2FYhAwkp0zx8UavTKsLHeW5EROONQJ9U4dFvll5FH619EfsBtQuSThBCBjCykVnlIAxvZ2S%2BiQuj3YJ7Mpnf7t0uTYPd9GGufyq1z5IhtaWbUCLLeVONlgS%2BKnYM1IymuxbzxD2SBKdpSMnjbiK4DD%2B4uxAAxmsRsLpAs74FEIKzpHaEu%2B0gcUAllLJWOV7vk0b%2FD2nZgNY8UsNoSDOocOLtPYbqviKp3d4AH2t%2BBs9w1n3tN0ftBxSstU76FBnPwJkMYEe6dmA812uL0GXKFw9bl3yF7dS8Egut%2FhZbIOGQudxuqCqlfV4AeaVLm4ts821M8Fl%2FON0BYA%3D%3D000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000&in_tx_username={1}&in_pw_userpass={2}&in_se_authsource=DBWS&catype=2", txtUser.Text.Trim(), txtUser.Text.Trim(), txtPwd.Text.Trim());
HttpHelper http = new HttpHelper();
HttpItem item = new HttpItem()
{
URL = "http://10.128.1.1:8001/portal/server.pt",//URL 必需项
Method = "post",//URL 可选项 默认为Get
IsToLower = false,//得到的HTML代码是否转成小写 可选项默认转小写
Cookie = "",//字符串Cookie 可选项
Referer ="http://10.128.1.1:8001/portal/server.pt",//来源URL 可选项
Postdata = postData,//Post数据 可选项GET时不需要写
Timeout = 100000,//连接超时时间 可选项默认为100000
ReadWriteTimeout = 30000,//写入Post数据超时时间 可选项默认为30000
UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT6.0)",//用户的浏览器类型,版本,操作系统 可选项有默认值
ContentType = "application/x-www-form-urlencoded",//返回类型 可选项有默认值
Allowautoredirect = false,//是否根据301跳转 可选项
//CerPath = "d:\123.cer",//证书绝对路径 可选项不需要证书时可以不写这个参数
//Connectionlimit = 1024,//最大连接数 可选项 默认为1024
ProxyIp = "",//代理服务器ID 可选项 不需要代理 时可以不设置这三个参数
//ProxyPwd = "123456",//代理服务器密码 可选项
//ProxyUserName = "administrator",//代理服务器账户名 可选项
ResultType = ResultType.String
};
HttpResult result = http.GetHtml(item);
string html = result.Html;
string cookie = result.Cookie;
MessageBox.Show(html);
这是我的c#代码,我用我自己的usbkey截取到的post数据能登陆进去,如果换key的话那段代码要变,就不能登陆了,请教下大家如何实现替换 |
|