111,092
社区成员




积分余额:<span class="high_ttl" id="creditAvail">0</span><a href="http://jf.sdo.com/" target="_blank">[查看]</a>
private void button2_Click(object sender, RoutedEventArgs e)
{
string strHTML = string.Empty;
//登录
myCookieContainer = new CookieContainer();
string loginUrl = "http://dplogin.sdo.com/dispatchlogin.fcgi?service=http%3A%2F%2Fjf%2Esdo%2Ecom%2FRedirectPage%2Easpx%3Ftarget%3DUserHouse%2FQueryScore%2Easpx";
string loginPost = "warn=false<=test&_eventId=submit&idtype=0&gamearea=0&gametype=0&username={0}&password={1}&ekey=&challenge=&domaink=jf.sdo.com&templateId=&sdid=&pageType=&infoEx=&uid=&appArea=0&appId=0&service=http%3A%2F%2Fjf.sdo.com%2FRedirectPage.aspx%3Ftarget%3DUserHouse%2FQueryScore.aspx&code=2";
strHTML = HTTPPOST(loginUrl, string.Format(loginPost, "da3fdsds", "1230"));
if (strHTML.Contains("通行证和密码不匹配"))
{
//
}
else
{
//string strReDirect = Regex.Match(strHTML, "location.href=.*", RegexOptions.IgnoreCase).Value;
//strReDirect = strReDirect.Replace("location.href=\"", "").Replace("\";", "");
string strReDirect = "http://www.sdo.com/index.asp";
strHTML = HTTPGET(strReDirect); //到了这一步就不行了 }
}
}
public string Get(string url, string referer)
{
int num = this.tryTimes;
while (num-- > 0)
{
try
{
if (this.delayTime > 0)
{
Thread.Sleep((int) (this.delayTime * 1000));
}
HttpWebRequest request = (HttpWebRequest) WebRequest.Create(new Uri(url));
request.UserAgent = this.reqUserAgent;
request.CookieContainer = this.cookieContainer;
request.Referer = referer;
request.Method = "GET";
request.Accept = "text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5";
request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8";
request.Timeout = this.timeout;
if ((this.proxy != null) && (this.proxy.Credentials != null))
{
request.UseDefaultCredentials = true;
}
request.Proxy = this.proxy;
HttpWebResponse response = (HttpWebResponse) request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8);
return reader.ReadToEnd();
}
catch (Exception exception)
{
Console.WriteLine(exception.Message);
continue;
}
}
return string.Empty;
}