Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Cookie Demo needed
#5
(04-25-2019, 06:14 AM)DanBarclay Wrote:
(04-25-2019, 05:05 AM)cpstevenc Wrote: I ran into those too.. either calls changed, or missing some information in those original posts.

I need cookies that are not locked to the session. So user can come back at a later date and data is there to grab?

Try this to set your cookie.
 
Code:
 webapplication.Response.Cookies.Add(THTTPCookie.Create(CookieName,CookieValue,'/',Expireon,true));
ExpireOn is the UTCDateTime (as a Real).  Set to -1 for a session cookie.
Name/Value are String.

Try this to read the cookie:
Code:
  Result := webapplication.Request.CookieFields.Values[sName];

It should work, but there may be better ways.

Dan

Thanks!

UTCDateTime was my issue.  

Also used Chrome inspector and took me a bit to find the call that was actually kicking off the COOKIE code to save and saw my date being used was in like 1927 .... so expired Smile
Reply


Messages In This Thread
Cookie Demo needed - by cpstevenc - 04-24-2019, 02:42 AM
RE: Cookie Demo needed - by DanBarclay - 04-24-2019, 06:02 AM
RE: Cookie Demo needed - by cpstevenc - 04-25-2019, 05:05 AM
RE: Cookie Demo needed - by DanBarclay - 04-25-2019, 06:14 AM
RE: Cookie Demo needed - by cpstevenc - 05-05-2019, 05:57 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)