Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re^4: Setting Cookies First and Redirecting Page

by Anonymous Monk
on Sep 15, 2006 at 19:14 UTC ( [id://573229]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Setting Cookies First and Redirecting Page
in thread Setting Cookies First and Redirecting Page

I am using:
print $query->redirect(-URL => $url,-COOKIE => [$cookie1,$cookie2]);

It redirects, but the cookie doesn't get set.

Replies are listed 'Best First'.
Re^5: Setting Cookies First and Redirecting Page
by derby (Abbot) on Sep 15, 2006 at 20:09 UTC

    Works for me:

    #!/usr/bin/perl use CGI qw( :standard ); $cookie = cookie( -name => 'sessionID', -value => 'xyzzy', -expires => '+1h', -path => '/', -domain => '.foo.com', ); print redirect( -url => 'http://login.foo.com', -cookie => $cookie );
    Do you have some other portion of the code outputting header stuff that would interfere? Why do you say it's not working. What client? IE? Firefox?

    -derby
Re^5: Setting Cookies First and Redirecting Page
by ptum (Priest) on Sep 15, 2006 at 19:52 UTC

    As I said earlier, I haven't tried it, so I cannot offer any guarantees ... but that is a bit strange. Are you redirecting within the same domain as your cookie? Can you show the code you are using to determine if the cookie is set in the destination script?

    Is it essential that you set the cookies on the first page ... if not, it might be the path of least resistance to set them on the destination page ... ?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://573229]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-04-23 14:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found