aspose file tools*
The moose likes Java in General and the fly likes Session Cookies Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Session Cookies" Watch "Session Cookies" New topic
Author

Session Cookies

ishwar shah
Greenhorn

Joined: Nov 19, 2007
Posts: 4
I want to acces a website. I have username and Password for the same.
What i am doing is accessing the website. Taking the cookie and sending it againg with username and password to reach deeper in the site.

But it is giving that access permission not granted.
It seems it is not receiving the cookie.

Can anyone please help me over the same.

I am using, HTTPS URL Connection.


Regards,<br />IRS.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Are you sure the site is using cookies for authentication? Perhaps you need to use POST data each time. Or the security is built into the web server.

In the former case you'll need to send the post data:


In the second case you'll have to use an Authenticator:


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
ishwar shah
Greenhorn

Joined: Nov 19, 2007
Posts: 4
Thanks for the reply Rob.
I appreciate that.

But I guess my query was bit unclear.
THe thing is I am able to get my Username and Password through, but the session is not being maintained.
For instance, It behaves exactly in the same manner if you Block Cookie Acceptance from Browser viz: IE or Mozilla.

So the problem is - Session Is Not Getting maintained because ,
The Second URL is NOT RECEIVING MY COOKIE ITSELF.
ishwar shah
Greenhorn

Joined: Nov 19, 2007
Posts: 4
Rob,
Yes i am sure about the site using cookies for maintaining session.

And I am using POST Method.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19761
    
  20

Try using HttpClient from Apache.
Anjanesh Lekshminarayanan
Ranch Hand

Joined: Oct 21, 2003
Posts: 46
When using PHP + cURL, we can set the file-location of the cookie file to store the cookies.

This way, when the program (or another program) is run again and connects to the same URL, it can get the cookies from cookie.txt.

Is something like this possible via the java.net.* library (JDK 6) ?
[ December 09, 2007: Message edited by: Anjanesh Lekshminarayanan ]

Anjanesh Lekshminarayanan
Malayathi Partha Saradhi
Greenhorn

Joined: Nov 30, 2007
Posts: 10
Ishwar, please check the browser wheater it supports cookies or not.
check SECURITY TAB IN BROWSER,in which cookies radio button is enabled or disabled.
ishwar shah
Greenhorn

Joined: Nov 19, 2007
Posts: 4
Thanks for the replies guys,

Yes the browser does accept cookies. As matter of fact it is quite advanced.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Cookies