|
-
February 15th, 2001, 04:14 PM
#1
Sending cookies to webpage in Java
I have a Java app (not a servlet) that passes an ID & a password to a webpage and receives two cookies in return.
I am trying to go to the next webpage by sending the cookies back, but that is failing -- I am pretty sure that I am sending the cookies incorrectly.
A snippet of my code is below -- does anyone have any ideas? Thank you!
URL url2 = new URL("http://sctweb11.sctcorp.com/awsearch/sct/sctlogin.asp");
HttpURLConnection lobjConnection = (HttpURLConnection) url2.openConnection();
//I am using IBM VisualAge for Java, & I'm not sure if it takes "cookie" or "set-cookie", so I'm doing both.
//If I try to set the cookies twice, only one of them is there when I do a getRequestProperty.
lobjConnection.setRequestProperty("cookie", "IIDENT=1229;ICNTCT=129");
lobjConnection.setRequestProperty("set-cookie", "IIDENT=1229;ICNTCT=129");
lobjConnection.setDoOutput(true);
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|