Cookie not enabled while using HttpPOST

Problems with WiFi, SQLite ,Bluetooth, WiMax, Proxies, etc...

Cookie not enabled while using HttpPOST

Postby anurahim » Mon Nov 10, 2008 2:51 pm

I wanted to login to a website thru my application, For that i used

DefaultHttpClient client = new DefaultHttpClient();
HttpPost postmethod = new HttpPost("the url to submit the login data and related parametrs");

//set header for the postmethod and executed the client,

but I am getting the response as "COOKIE NOT ENABLED IN YOUR BROWSER".
( which is the same I can see as when i disabled my browser cookie and entering the login url ).

I could get all the cookies in
List<Cookie> cookies = client.getCookieStore().getCookies();

But how can I post the cookie to the login url?

can I post the COOKIE obj as header , How is it done. Please Help me with some sample code.
Junior Developer
Junior Developer
Posts: 24
Joined: Fri Jun 27, 2008 11:26 am


Postby ismarc » Mon Nov 10, 2008 5:31 pm

Once the POST is completed, you can get the cookies from the HttpClient via
CookieStore cookies = httpclient.getCookieStore();

Once you have the cookies, you can assign them to the HttpClient via
Posts: 9
Joined: Mon Sep 29, 2008 6:09 am


Return to Networking & Database Problems

Who is online

Users browsing this forum: No registered users and 2 guests