Google Answers Logo
View Question
 
Q: using cookies to maintain session manually ( Answered,   2 Comments )
Question  
Subject: using cookies to maintain session manually
Category: Computers > Programming
Asked by: ruggles-ga
List Price: $20.00
Posted: 02 Jun 2002 09:43 PDT
Expires: 09 Jun 2002 09:43 PDT
Question ID: 20218
I am writing a Java application which post user id and pwd to an URL.
Then, it
reads the response back from the server and extract the value of the
"Set-Cookie" field.Moreover, it also read and store an URL that the
server sends back. Then, it posts that "Session-Cookie"  value to this
new found URL to read the content of this particular URL.

Info:  the path value in the response header is set to "/", and the
both URLs are at the root directory. I have extracted the value of the
"Set-Cookie" field but could not post the cookie to the new found URL.



I would like to know, how to post the cookie to this new found URL so
that it can recognize me as a valid user and let me read it's content.


Thanks

Request for Question Clarification by lazerfx-ga on 02 Jun 2002 09:59 PDT
Are you attempting to do cross site cookies?  I.e. read the cookie
from one site and post the cookie to another site?

Or are you attempting to read the cookie from your site, and then post
it back to your site via the java application?
Answer  
Subject: Re: using cookies to maintain session manually
Answered By: netcrazy-ga on 02 Jun 2002 15:30 PDT
 
Hi,
I'm answering you for 2 different possible scenarios in your case and
in case these are not applicable to your requirement, I'll be very
much willing to help you out further. You are free to ask for
clarifications.

First scenario:
You are trying to post cookies in a domain other than your domain i.e.
Cross site cookie:
If this is the case, then you'll not be able to post the cookie to
another case, as the other domain will not recognize your domain
cookie unless there is a common cookie provider which does the
handshaking for both the domain cookies to remain valid. Cookies are
labelled with the domain from which they were set. Web Browsers or
HTTP-Clients restrict Cookies from being passed to domains from which
they were not set from. If you are looking for posting to another
domain, then I'll suggest that you post the contents of the cookie in
the form of a url string in an encrypted manner and then on the other
domain you decrypt the url string and then create a cookie. In this
way, your data will be secured and cookies will also be available for
maintaining the sessions. You can also use SSL certificates to make it
very much secured but this will add cost.
I've recently done this and this works fine without any error. The
environment I've used is a mix of iPlanet and IIS webservers on Unix
and NT platforms.
Check out this site also for how to work with Cross site cookies:
http://www.phpbuilder.com/columns/chriskings20001128.php3

Second scenario:
You are in the same domain and you want to post it also in your same
domain:
This is very simple case. All you've to do is that read the cookie in
a loop, get the contents stored in some array variable and then post
the contents back to your site.
Here is a site which gives all the info you can have related to
cookies. They have also given sample code for various test cases which
will really help you very much.
http://www.cs.du.edu/~sdeshpan/comp4708/Lesson7/Part2.html

I hope this helps. Feel free to ask for clarification.

Regards,
netcrazy
Comments  
Subject: Re: using cookies to maintain session manually
From: dslus-ga on 05 Jun 2002 02:01 PDT
 
netcrazy: please contact me to answer a similar question...
Subject: Re: using cookies to maintain session manually
From: netcrazy-ga on 05 Jun 2002 07:30 PDT
 
Hi dslus,
I cannot contact you unless I've your contact details, which we cannot
get on google. I'll suggest you to post a question "specifically for
me". I'll then answer it for you. You can mention any timeline in
which I should take that question. If within that timeline I take it
then I'll answer it else after that time, any researcher will answer
it. But make sure that you are giving enough time for me to get hold
of your question. I'm constantly checking questions on google.
And thanks for asking me specifically to answer your question. 
Waiting for your question.
Regards,
netcrazy

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy