Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Losing my Cookie

by Herkum (Parson)
on Oct 17, 2008 at 16:43 UTC ( #717795=perlquestion: print w/replies, xml ) Need Help??

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

I have been using CGI::Session to keep my users information. However, I noticed that when I go to a regular HTML page on the web site. I have lost my cookie and have to authenticate myself again.

I guess I am missing a parameter in CGI::Session but I am not sure what, does anyone have an idea of what I am missing?

Replies are listed 'Best First'.
Re: Losing my Cookie
by ggvaidya (Pilgrim) on Oct 18, 2008 at 04:05 UTC

    I'm a big fan of going to the source on matters like this :-).

    A really nice way of debugging cookie-related problems is by looking at your browser's "Page information" or "Site information" dialog box (in Opera, it's called "Edit Site Preferences", and is in the menu you get if you right click on a page). This dialog box will show you a list of all the cookies your browser has, including when they expire, the path and domain they apply to, and all kinds of other information. You could check to see if there is any reason that cookie might not apply or be sent to the HTML page from there.

    Also: How do you get the session id to the browser? Do you use $session->header() or CGI::header or CGI::Cookie in your code anywhere? If you do, the actual cookie settings you use there might also be helpful in debugging your problem.

      Another handy tool is the Live HTTP Headers Firefox Extension. This shows the HTTP headers as they are sent and received.
Re: Losing my Cookie
by tmaly (Monk) on Oct 17, 2008 at 21:05 UTC
    Check out the way CGI::Application::Plugin::Session uses CGI::Session I ended up using the logic it uses and I have not had any problems
      Actually I am use CAP::Session, and it works fine so long as I display pages via perl script. If I ask for a static page, like HTML, for some reason the cookie is not sent so the browser removes it. It is probably my ignorance of how cookies are supposed to work...
      $session->expire('+1M'); # expire after a month and so on.
Re: Losing my Cookie
by Freezy (Scribe) on Oct 18, 2008 at 14:39 UTC
    It's tricky to know if you are missing a parameter or using another incorrectly without some code! It would be helpful if you would post some cookie setting/getting snippets, if the suggestions provided by others do not lead to your solving the problem.
Re: Losing my Cookie
by wol (Hermit) on Oct 19, 2008 at 21:59 UTC
    no Cookie::Monster;

    --
    .sig : File not found.

      How about setting Session id to cookies of a page, which belongs to header of HTML.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://717795]
Approved by ikegami
Front-paged by Narveson
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (6)
As of 2019-06-27 10:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Is there a future for codeless software?



    Results (111 votes). Check out past polls.

    Notices?