You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Glen Small <gl...@icl.net> on 2001/06/26 16:25:50 UTC
Cookies and redirection
All,
I'm having some problem setting a cookie in a logon script i have. The code work fine as a CGI, and also under mod)perl, however, I want to set a cookie during the login script, and then redirect the browser to another page. When I enter the code below into the mod_perl script, the browser tries to download login.pl, rather than running it. If I print the HTTP header to the screen, it looks fine, but it wont run.
This code below works fine under normal CGI. Any thoughts ?
use CGI;
use CGI::Cookie;
my $q = new CGI;
.......
my $cookie = new CGI::Cookie(-name => 'testlogger', -value=> $UserID, -path => '/');
print $q->redirect(-uri=>'/perl/home.pl', -nph=>'1', -cookie => $cookie);
.......
Re: Cookies and redirection
Posted by darren chamberlain <dl...@users.sourceforge.net>.
Glen Small <gl...@icl.net> said something to this effect on 06/26/2001:
> I'm having some problem setting a cookie in a logon script i
> have. The code work fine as a CGI, and also under mod)perl,
> however, I want to set a cookie during the login script, and
> then redirect the browser to another page.
http://perl.apache.org/guide/snippets.html#Sending_Cookies_in_REDIRECT_Resp
--
The kind of thinking we do sets the stage for the action we are likely
to take. Because of this, a man who refuses to develop his thinking
is likely to act on the impressions made upon him by others.
-- Dr. Claude R. Baker, "Coin In The Air"