Problem with IE and Cookie

V

Vijoy Varghese

Hi Friends,

I created a cgi program which make use of the cookies to check user
authentication. And for creating cookies i make use of cgi::cookie. I
am having a weird problem...

use CGI::Cookie;

my $cookie1 = cookie(-name => 'foo',
-value => 'bar',
-expires => '+3M'
);
print header(-cookie=>[$cookie1]);



My cookie program works fine when i run the program on the local
webserver and view it on my internet explorer/mozilla browsers.

But when i tried the same program from a remote webserver the scipt is
not working properly with internet explorer. Everything is fine with
mozilla.

When i tried to debug the problem, i found that cookies are not
falling to IE's cookie folder when i use the remote script. But when i
tried the script from a frineds house and used IE, everything is
working fine. And if you doubt that i havenot properly set my cookies
setting of my IE, no! everythingis properly configured. I can see
cookies from other websites in my cookie folder, but my program is not
able to put any cookies. Why is this so?

It's not the problem of my program, because its working properly in
other browsers(other than my home one).
It cant be the problem of my browser, because the script works
properly using a local webserver, and on internet cookies from all
other websites works fine.

Then who is the culprit?

please help

Regards
Vijoy Varghese.
 
C

Chad Hanna

Vijoy said:
Hi Friends,

I created a cgi program which make use of the cookies to check user
authentication. And for creating cookies i make use of cgi::cookie. I
am having a weird problem...

use CGI::Cookie;

my $cookie1 = cookie(-name => 'foo',
-value => 'bar',
-expires => '+3M'
);
print header(-cookie=>[$cookie1]);



My cookie program works fine when i run the program on the local
webserver and view it on my internet explorer/mozilla browsers.

But when i tried the same program from a remote webserver the scipt is
not working properly with internet explorer. Everything is fine with
mozilla.

When i tried to debug the problem, i found that cookies are not
falling to IE's cookie folder when i use the remote script. But when i
tried the script from a frineds house and used IE, everything is
working fine. And if you doubt that i havenot properly set my cookies
setting of my IE, no! everythingis properly configured. I can see
cookies from other websites in my cookie folder, but my program is not
able to put any cookies. Why is this so?

It's not the problem of my program, because its working properly in
other browsers(other than my home one).
It cant be the problem of my browser, because the script works
properly using a local webserver, and on internet cookies from all
other websites works fine.

Then who is the culprit?

please help

Regards
Vijoy Varghese.
Setting a cookie that expires 3 minutes in the future is NOT a good idea
- as I found out.

The clocks on many computers are out of sync with reality - wrong time,
wrong time zone, wrong year! In other words, the cookie may have already
expired as far as the browser's concerned (the +3M is converted to a
real time at the server end - not the client end).

Far better to use a session cookie and check the received cookie against
an expiry time stored at the server - tedious isn't it.

I believe there is a new cookie spec that resolves this problem but
everyone is stuck with the old way of doing things.

Hope this helps
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,681
Members
48,796
Latest member
Greg L.

Latest Threads

Top