My problem with setting cookies was learning all the various and sundries associated with debugging them. I was following the masonbook.com login pattern, only I was using apache2. It didn't work as typed and I didn't know how to approach it.

I got several suggestions from a query at perlmonks.org, but none of the help. I finally cornered some people on chatterbox that helped me learn how to debug it.
1) To see if the cookie is set by the page, comment out the redirect and use a tool like the liveHTTPheaders plugin for firefox.
2) Check to see if the cookie is being set on the client. For firefox this means clicking tools/options/privacy/cookies/view cookies. With IE you check the file system: C:\documents and settings\username\cookies
3) If you are not seeing the cookie, it is probably some combination of expiration/path/domain that are hosed up.

Additional notes:
- Assuming a login cookie is used for the whole site, set the path to '/'. Omitting the path will actually set the path to the current directory, which is probably not desirable given the assumption.
- Do not set the domain. I'm not sure if you can set this parameter to multiple domains, but every variation on a domain sets a separate cookie. For example, if you specify you domain as www.whatever.com, a client accessing the site as whatever.com will not get the cookie.
- One pointer that was given, but not verified, was that Apache2::Cookie expects a string, not a hash as the masonbook.com example shows. I replaced the hash with a comma separated string, but I'm not sure it was necessary as I had other issues at the time.

Hope this helps...

Jimbus

John (Versimedia Admin) wrote:
I have a login page using Mason -- where the user types a username/password and if successful, they will be redirected to the front page of the site.

The problem is, I need to set a Cookie on the redirect -- and it seems that whichever redirect method I use, that the cookies disappear (they don't show in the returned header).

How can I do a redirect to a new page (not new mason code) + Set a cookie in mason?

I know how to do it manually (IE: creating the header) -- is it possible to abort output from mason and send my own header I create manually (ie: thru print statements)

Or is there another way to handle this...

Thanks
-John




-------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Mason-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mason-users


--
Jim Babcock
[EMAIL PROTECTED]
[EMAIL PROTECTED]
jimbus.net

Reply via email to