[C#] 纯文本查看 复制代码
var url = uri + settings.loginValidationCodeUri;
http2 = new httpHelper2();
HttpItem item = new HttpItem()
{
URL = url,
Method = "Get",
Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/x-silverlight, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, application/x-silverlight-2-b1, */*",
ResultType = ResultType.Byte,
};
if (settings.proxyUp)
{
item.ProxyIp = settings.proxyIp;
item.ProxyUserName = settings.proxyUserId;
item.ProxyPwd = settings.proxyUserPwd;
}
HttpResult result;
lock (http2)
{
result = http2.GetHtml(item);
validate(result);
cookie = result.Cookie;
}
string code = ihelper.ReImage(result.ResultByte,settings.ValidationCodeX,settings.ValidationCodeY,true);
if (code.Length == 4)
{
var newpwd = helper.CfsPas(userPwd);
newpwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(newpwd, "MD5").ToLower();
item = new HttpItem()
{
URL = uri + settings.loginUri,
Method = "Post",
Cookie = cookie,
CookieCollection = result.CookieCollection,
ContentType = "application/x-www-form-urlencoded",
Postdata = string.Format("lang=zh&ID={0}&PWD={1}&Code={2}", userId, newpwd, code),
};
result = http2.GetHtml(item);
以上代码 但是 碰到 ASPX页面 模拟登录时 就会返回
<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="xxxxx.aspx">here</a>.</h2>
</body></html>
验证码 经过验证也是 正确的.
实在想不到头绪,就来 论坛求助了, 希望各位相助...
|