在ie登录成功会跳转页面
抓包post后的数据如下:
HTTP/1.1 302 Found
Date: Sat, 17 Dec 2011 03:03:43 GMT
Server: Microsoft-IIS/6.0
X-Powered-By: ASP.NET
X-AspNet-Version: 2.0.50727
Location: http://www.ordroshop.cn/VipHome.aspx
Set-Cookie: ASP.NET_SessionId=d0bejn55ke5jou55vqao1u55; path=/; HttpOnly
Set-Cookie: j6ZJnpOJgJcqEuXCO5GZgzN0XF7eV%2Bl7=Id=YVnZLA8Oiaw=&Account=K2%2BUldK9l2YzdFxe3lfpew==&Type=aWrzlN6mAyI=; path=/
Cache-Control: private
Content-Type: text/html; charset=utf-8
Content-Length: 153<html><head><title>Object moved</title></head><body>
<h2>Object moved to <a href="http://www.ordroshop.cn/VipHome.aspx">here</a>.</h2>
</body></html>个人的程序如下
procedure TForm1.btnStartClick(Sender: TObject);
var
  F: TextFile;
  FileName: String;
  url: String;
  FeedBack: String;
  mStream: TMemoryStream;
  sData: String;
  Feedback: String;
  Data: TStrings;
  n, n1, n2: Integer;
begin
  FileName := FPath + 'temp.txt';
  url := 'http://www.ordroshop.cn/login.aspx';
  mStream := TMemoryStream.Create;
  FHttp := TIDHttp.Create(nil);
  FHttp.HandleRedirects := True;
  Feedback := FHttp.Get(url);
  FHttp.Get(url, mStream);
  mStream.SaveToFile(FileName);
  FreeAndNil(mStream);
  AssignFile(F, FileName);
  Reset(F);
  while Not Eof(F) do
  begin
    ReadLn(F, Data);
    Data := utf8toansi(data);
    n := pos('__VIEWSTATE', sData);
    if n > 0 then
    begin
      n1 := pos('value="', sdata);
      n2 := pos('" />', sdata);
      FViewState := copy(sdata, n1 + 7, n2 - n1 - 7);
      mminfo.Lines.Add(FViewState);
    end;
    n := pos('__EVENTVALIDATION', Data);
    if n > 0 then
    begin
      n1 := pos('value="', sdata);
      n2 := pos('" />', sdata);
      FViewState := copy(sdata, n1 + 7, n2 - n1 - 7);
      mminfo.Lines.Add(FViewState);
      break;
    end;
  end;
  CloseFile(F);
  //上面的程序为了得到__VIEWSTATE和__EVENTVALIDATION的值  Data := TStringList.Create;
  Data.Add('__VIEWSTATE=' + FViewState);
  Data.Add('__EVENTVALIDATION=' + FEventValidation);
  Data.Add('=');
  Data.Add('txtAccount=ZXdgMwRX');
  Data.Add('txtPassword=DkEn9I866');
  Data.Add('LoginSubmit.x=54');
  Data.Add('LoginSubmit.y=22');
  Feedback := FHttp.Post('http://www.ordroshop.cn/login.aspx', data);
  mminfo.Lines.Add(Feedback);
end;程序执行到FeedBack := FHttp.Post('http://www.ordroshop.cn/login.aspx', data);
出现project temp.exe raised exception class EIdHTTPProtocalException with message 'HTTP/1.1 500 Internal Server请问各位老大帮忙看看

解决方案 »

  1.   

    在IDHTTP的OnRedirects事件中写转向的代码.!
      

  2.   

    IE或者Webbrowser都不会出现这样问题。跟post提交有没有关系,数据段有个字段的内容超过1000个字节
      

  3.   

    有哪位高手帮忙用idhttp试下登录http://www.ordroshop.cn/login.aspx,用户名:ZXdgMwRX,密码:DkEn9I866,谢谢!
      

  4.   

    这是要post数据的两个字段的内容,应该没非法字符吧/wEPDwUKMTg2NzA3OTY4MQ9kFgICAQ9kFgICCQ9kFgoCAQ8WAh4LXyFJdGVtQ291bnQCBhYMZg9kFgJmDxUCDnprYmtrRDNEYSUyQjQ9Euasp+i+vuWVhuWfjueugOS7i2QCAQ9kFgJmDxUCDGRhVjVFZncyejNNPQzkubDlrrblv4Xor7tkAgIPZBYCZg8VAgxCd3JjQTJCODlMRT0M5ZOB54mM5pWF5LqLZAIDD2QWAmYPFQIMWlg4RTVIYWcwalU9DOaLm+WVhuivtOaYjmQCBA9kFgJmDxUCDEovYTVhNjNEZExjPQzogZTns7vmiJHku6xkAgUPZBYCZg8VAg5VbUhvTCUyQndaNkM4PQzogZTns7vlrqLmnI1kAgMPFgIfAAICFgRmD2QWAmYPFQIMMndQalF3eGFPdDA9DOS4iumXqOiHquaPkGQCAQ9kFgJmDxUCDGFoalN3YlRsRGJjPQzlv6vpgJLov5DovpNkAgUPFgIfAAICFgRmD2QWAmYPFQIMcFZZZ2JkeU55djg9DOWcqOe6v+aUr+S7mGQCAQ9kFgJmDxUCDEU0UEU3UTJmek44PQzotKfliLDku5jmrL5kAgcPFgIfAAIEFghmD2QWAmYPFQIMU0ZVeFk0dWFhMkE9DOmAgOasvuivtOaYjmQCAQ9kFgJmDxUCDElTMnllNGZ3T3Y4PQ/pgIDmjaLotKfmlL/nrZZkAgIPZBYCZg8VAgw1dUg1Z0hPU0wzbz0P6YCA5o2i6LSn5rWB56iLZAIDD2QWAmYPFQIMUjQ0NGZWR3c4NlE9DOi0reeJqeS/nemanGQCCQ8WAh8AAgUWCmYPZBYCZg8VAgoxNDI3ODQ4MDU0E+asp+i+vuWuouacjTrlsI/pkr9kAgEPZBYCZg8VAgk4MTkwNDc1NzcT5qyn6L6+5a6i5pyNOuWwj+asomQCAg9kFgJmDxUCCjIzODczMTYxMDkV5qyn6L6+5a6i5pyN77ya5bCP6buRZAIDD2QWAmYPFQIKMjUwMjYzODI2NxXmrKfovr7lrqLmnI3vvJrlsI/lvaRkAgQPZBYCZg8VAgoxNTQwNzM5MTc1Feasp+i+vuWuouacje+8muWwj+Wpt2QYAQUeX19Db250cm9sc1JlcXVpcmVQb3N0QmFja0tleV9fFgEFC0xvZ2luU3VibWl0y1JRSlmKcHGmDSpjHWMaA/EzlOo=/wEWBAKu2/+BAQKUj8fhDAK1qbSRCwLFvMu4DFazqcctlQdyErBDvr4iPHqO/tuA
      

  5.   

    从Google上找到一个老外的帖子解决问题,百度不给力啊,结贴。