ralphch has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I'm setting a cookie for an Admin System in the following way: print "Set-Cookie: northlands=staff&$fr{username}-$zones; PATH=/; domain=.domain.com\n\n";
And then reading it with $ENV{HTTP_COOKIES}.

On most systems it works just fine, but on some Windows XP PCs using IE, the cookie won't be set unless lots of security settings are changed. Is there any fix to this? Or maybe use some other type of authentication form (sessions? -never used these before-)? Something that can be migrated to easily.

Thanks,
Ralph

Edit by castaway, unceremoniously unconsidered (was considered as dupe of itself: 4/1/16)

Replies are listed 'Best First'.
Re: Cookie issue on some systems
by Joost (Canon) on Jun 28, 2004 at 18:47 UTC
    I used to have similar constructs to read and set cookies, but since it turned out to be very error prone, and I'm lazy, I now use the cookie system that's build in in CGI and CGI::Cookie.

    I suggest you give it a try.

    Joost.

    PS: There might still be problems with setting cookies on certain browsers because of privacy setting and the like, but at least you can be reasonably sure it's not your code that's the problem.

Re: Cookie issue on some systems
by ralphch (Sexton) on Jun 28, 2004 at 17:53 UTC

    I finally ended up changing the code to use CGI::Session and passing the session ID along the query string, instead of using cookies. Right now, it's all running as mod_cgi. Were I to migrate it to mod_perl in the future, would CGI::Session have any problems?

    Thanks,
    Ralph