日期:2014-05-17  浏览次数:21053 次

C# post淘宝可以登录,但是一淘网却登录不了
post提交,淘宝可以登录,但是一淘网登录不了,抓包的时候发现,一淘也是先登录淘宝,然后跳转到www.etao.com的页面。
但是试了好久都没成功,想请问大家,问题出在哪里?有类似经验的人,请帮忙,谢谢大侠了!

POST的数据是下面这些:
TPL_username="+username+"&TPL_password="+password+"&TPL_checkcode=&need_check_code=&_tb_token_=fe47e363575bb&action=Authenticator&event_submit_do_login=anything&TPL_redirect_url=http%3A%2F%2Flogin.etao.com%2Floginmid.html%3Fredirect_url%3Dhttp%3A%2F%2Fwww.etao.com&from=etao&fc=2&style=miniall&css_style=etao&tid=XOR_1_000000000000000000000000000000_63584452460B0D7879007170&support=000001&CtrlVersion=1%2C0%2C0%2C7&loginType=3&minititle=&minipara=&umto=T4710c9478ad11b5adbb5c6d7ee7893e4%2C200&pstrong=2&llnick=&sign=&need_sign=&isIgnore=&full_redirect=&popid=&callback=&guf=&not_duplite_str=&need_user_id=&poy=&gvfdcname=10&gvfdcre=&from_encoding=

下面是抓包的截图


 CookieContainer mycookie = new CookieContainer();

HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(url);
  myRequest.CookieContainer = mycookie;
  myRequest.Method="POST";
  myRequest.ContentType="application/x-www-form-urlencoded";
  myRequest.UserAgent = "Mozilla/4.0 (compatible; MSIE 8.0; Windorews NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET4.0C; .NET4.0E)";
  myRequest.KeepAlive = true;
  byte[] postBytes = Encoding.Default.GetBytes(postStr);
  myRequest.ContentLength = postBytes.Length;

  using (Stream requestStream = myRequest.GetRequestStream())
  {
  requestStream.Write(postBytes, 0, postBytes.Length);
  using (HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse())
  {
  using (Stream responseStream = myResponse.GetResponseStream())
  {
  using (StreamReader reader = new StreamReader(responseStream, Encoding.GetEncoding("GB2312")))
  {
  mycc.Add(myResponse.Cookies);
  string outdata = reader.ReadToEnd();
  return outdata;
  }
  }
  }
  }

------解决方案--------------------
探讨

求大侠帮忙啊,又研究了一天了,分数不是问题。。。