读书人

idhttp POST登录账号的时候显示“会话

发布时间: 2013-01-25 15:55:29 作者: rapoo

idhttp POST登录账号的时候显示“会话过期,请刷新本页面再登录”
idhttp POST登录账号的时候显示“会话过期,请刷新本页面再登录”

这个应该如何解决?

我是这么写的
///////////
procedure postdate;
var s,s2,str,CookieStr:string;
szh,smm:string;
strMsg:string;
sParams: TStringStream;
begin
form1.memo3.clear;
form1.IdHTTP1.Request.ContentType := 'application/x-www-form-urlencoded';
form1.idhttp1.Request.Referer:='http://www.jj.cn/user/login.php';
if ixl =form1.Memo2.Lines.Count -1 then exit ;
s:=trim(form1.Memo2.Lines.Strings[ixl]);
inc(ixl) ;
form1.sButton2.caption:=inttostr(ixl)+','+inttostr(form1.Memo2.Lines.Count);
s:=AnsiReplaceText(s,'----',',');
fenliduankoustr(s,szh,smm) ;
form1.Edit1.Text:=szh;
form1.Edit2.Text:=smm;
s2:='http://www.jj.cn/user/login.php' ;
{if CanGetIECookie(s2, str) then
begin
CookieStr := 'Cookie: ' + str;
form1.idHttp1.Request.CustomHeaders.Text := CookieStr;
end else
begin
//// ShowMessage('没有发现本地Cookie,请从Web页面登陆一次。');
Exit;
end; }
sParams := TStringStream.create('');
try
sParams.WriteString('comeurl=http%3A%2F%2Fwww.jj.cn%2F&isShowCode=0&key=912a549a179a313c6b7ff5c2a3bbc770&if_header=0&act=login&t=1340512049&username='+szh+'&password='+smm) ;
/// idhttp1.request.customheaders.text:='cookie:'+'dbsessionId=c89aa4d090825f47998eb6bd1fdeb8dc; cnzz_a2523094=0; sin2523094=; rtime=0; ltime=1323581940578; cnzz_eid=14226567-1323577009-';
strMsg:=form1.IdHTTP1.post('http://jj.cn/user/login.php',sParams) ;
form1.memo3.Text:=strmsg;
finally
sParams.Free ;
end;
end;

求解决

[解决办法]
key=912a549a179a313c6b7ff5c2a3bbc770 参数不对,是网页程序生成的参数才行

读书人网 >.NET

热点推荐