Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: try to send cookie and redirect

by wardk (Deacon)
on Apr 22, 2002 at 22:55 UTC ( [id://161172]=note: print w/replies, xml ) Need Help??


in reply to try to send cookie and redirect

This snippet works in one of my applications just fine, I think it meets your requiremeents for the most part. This is from a web-based login that redirects to the calling script.

Create and set cookie, then redirect.

my $cookie_name = "FOO" . $E . "SID"; my $SID_cookie = new CGI::Cookie(-name => $cookie_name, -value => $sid, -path => '/', -expires => "+2h", -domain => '.foobar.com', ); print "Set-Cookie: " . $SID_cookie . "\n"; print $q->redirect("$redirectURL");

Replies are listed 'Best First'.
Re: Re: try to send cookie and redirect
by Kanji (Parson) on Apr 22, 2002 at 23:12 UTC

    If you used CGI's named arguments-style, there's no need to craft your own 'Set-Cookie' header: redirect will do it for you, just like header.

    print $cgi->redirect( -uri => $new_url, -cookie => $cookie );

        --k.


Re: Re: try to send cookie and redirect
by Georgio (Sexton) on Apr 25, 2002 at 07:41 UTC

    It works just fine!
    Thanks a lot!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2024-04-18 02:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found