D
dave h
Hi, I'm unable to get cookies working on my IIS 6 Server and IE6 browser.
I'm using the latest version of Active Perl. I have a "home" page that runs
a perl cgi script that creates a cookie and also tries to read it when the
page is called again. I have a second page that calls the home page to
simulate a second request for the home page. I assume that the second time
the page is called the cookie should be present. The problem is that the
cookie never seems to get created. Any ideas on what is wrong with either
my approach or the syntax for creating the cookie?
Here is the "Home" page:
<html> <head>
<meta http-equiv="Content-Type" content="text/html">
<meta name="hideHeader" content="">
<title>index</title>
</head> <body>
this is a cookie test
<hr><!--#exec cgi="/perl1/CookieScript.pl" --> <hr>
<a href="http://localhost/perl1/perlHelper.htm">Another Page</a>
</body></html>
Here is the "Other" page - it just calls the home page - I assume the second
request for the home page should present the cookie back to the server
script:
<HTML> <HEAD>
<title>perlHelper</title>
</HEAD> <body>
some text<br>
<a href="http://localhost/perl1/index.shtml">Home Page</a>
</body></HTML>
And this is the perl script:
#! c:\perl\bin
use CGI qw/:standard/;
use CGI::Cookie;
my $q = new CGI;
my $c = $q->cookie( -name => "foo", -value => "bar", -expires => "+3M");
# create cookie
print $q->header(-type => "text/html", -cookie => $c); # put
cookie into the header to give to the browser
%cookies = raw_fetch CGI::Cookie; # get cookie
back from browser on subsequent request
foreach (keys %cookies)
{ print "$cookies{$_} <br>\n"; } # look at
all the cookies - I just get a default cookie
$fooValue = $q->cookie("foo"); # another
way to get at foo - never returns the "bar" value
print "fooValue: $fooValue \n"; # no
value printed
I'm using the latest version of Active Perl. I have a "home" page that runs
a perl cgi script that creates a cookie and also tries to read it when the
page is called again. I have a second page that calls the home page to
simulate a second request for the home page. I assume that the second time
the page is called the cookie should be present. The problem is that the
cookie never seems to get created. Any ideas on what is wrong with either
my approach or the syntax for creating the cookie?
Here is the "Home" page:
<html> <head>
<meta http-equiv="Content-Type" content="text/html">
<meta name="hideHeader" content="">
<title>index</title>
</head> <body>
this is a cookie test
<hr><!--#exec cgi="/perl1/CookieScript.pl" --> <hr>
<a href="http://localhost/perl1/perlHelper.htm">Another Page</a>
</body></html>
Here is the "Other" page - it just calls the home page - I assume the second
request for the home page should present the cookie back to the server
script:
<HTML> <HEAD>
<title>perlHelper</title>
</HEAD> <body>
some text<br>
<a href="http://localhost/perl1/index.shtml">Home Page</a>
</body></HTML>
And this is the perl script:
#! c:\perl\bin
use CGI qw/:standard/;
use CGI::Cookie;
my $q = new CGI;
my $c = $q->cookie( -name => "foo", -value => "bar", -expires => "+3M");
# create cookie
print $q->header(-type => "text/html", -cookie => $c); # put
cookie into the header to give to the browser
%cookies = raw_fetch CGI::Cookie; # get cookie
back from browser on subsequent request
foreach (keys %cookies)
{ print "$cookies{$_} <br>\n"; } # look at
all the cookies - I just get a default cookie
$fooValue = $q->cookie("foo"); # another
way to get at foo - never returns the "bar" value
print "fooValue: $fooValue \n"; # no
value printed