[prev in list] [next in list] [prev in thread] [next in thread]
List: httpclient-users
Subject: Re: cookie or session-id is different from the same HttpClient
From: Oleg Kalnichevski <olegk () apache ! org>
Date: 2008-02-29 9:13:45
Message-ID: 1204276426.5679.7.camel () ubuntu
[Download RAW message or body]
On Thu, 2008-02-28 at 17:19 +0800, micky wrote:
> Dear,
>
>
> I use the HttpClient to login some page, and it will have a cookie according to my \
> login.
> But when I try to access another page (needed for logon) by the same HttpClient, \
> the response is access denied.
> Then I print out the cookies of the two connection, I found them are different.
>
> But the document said I don't need to care the cookie issue when I use HttpClient \
> to login and continue browsing other pages.
> Here is some sample pseudo code to demo.
>
> ---------
> DefaultHttpClient httpclient = new DefaultHttpClient();
>
> HttpPost httpPost = new HttpPost("http://127.0.0.1/login.html");
>
> // response 200, and login ok!
> HttpResponse response = httpclient.execute(httpPost);
>
> HttpEntity entity = response.getEntity(); // cookie with a session id "1" for \
> example
> // continue to another page
> httpPost = new HttpPost("http://127.0.0.1/info.html");
>
> // response 200, and access denied
> HttpResponse response2 = httpclient.execute(httpPost);
>
> HttpEntity entity2 = response2.getEntity(); // cookie with a session id "2" for \
> example
> // the session is different
> ---------
>
> I think the session id in the cookie should be the same, so that I can browse all \
> pages after the first logon action.
> But the truth is not?! How it can be that??
>
> Thanks for any reply or suggestion.
>
> Sincerely,
> Micky
>
Micky,
Please execute your application with the 'org.apache.http' logger set to
DEBUG.
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.SimpleLog \
-Dorg.apache.commons.logging.simplelog.log.org.apache.http=DEBUG
Feel free to post the log to this list if you need help figuring out the
cause of the problem.
Oleg
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic