1

登录论坛后需要帮助保持会话。我正在使用 TIdHttp 并且已经分配了一个 cookie 管理器

  Http.Get(Url); //..Used to get session Id that is then stored in FSessionID

  Param := TStringList.Create;
  Param.Add('act=Login');
  Param.Add('CODE=01');
  Param.Add('s='+FSessionID);
  Param.Add('referer=''''');
  Param.Add('CookieDate=1');
  Param.Add('UserName=MYUsername');
  Param.Add('PassWord=MyPassword');
  Http.Post(Url,Param); //..The was Login succesfull. Made sure by checking responce
  Http.Get(Url); //..Now its not logged in. Why????
4

2 回答 2

1

确保 SessionID cookie 在到达时没有被 TIdCookieManager 拒绝。Indy 的 cookie 支持目前被破坏,导致有效的 cookie 有时会被忽略而不是存储。

于 2010-12-21T10:27:34.347 回答
0

在您的帖子中显示您将会话作为参数提供......这会让我假设您也需要在 Get 中提供会话作为参数。(cookie 似乎没有被使用。)

也许您将会话作为 URL 的一部分包含在内,如下所示:

Http.Get(URL + '?s=' + fSessionID)
于 2010-12-18T22:54:39.873 回答