Session Cooike problem

forum.centura.web.developer (2000-2005) & forum.td.web (2005-2010)
Dave Seay

Session Cooike problem

Post by Dave Seay » 27 Jan 2004, 16:08

 Posted by:  Dave Seay 

Attached is a sample app that demos the problem I am having.

I am trying to set session cookies but the values are getting lost...
sometimes!

If I click on the login button, the Web Alert shows the WebGet Cookie
commands found nothing. However, if I click on it a second time, they find
the values.

There is nothing other than code provided by Gupta in this app.

Can anyone help? I must be missing something real obvious.

Thanks,
Dave

Attachment: cookietest.app

Charles McLouth

Session Cooike problem

Post by Charles McLouth » 28 Jan 2004, 02:17

 Posted by:  Charles McLouth 

Dave,

I think I understand the behavior you are having an issue with...
In Gupta's Web Interface, there are two storages for Cookie data which are
Request(sent from Browser to Server) and Response (sent from Server to
Browser.) WebGet*Cookie functions retrieve cookie data from the Request
bucket(and only from the Request bucket.) WebPutCookie writes to the
Response bucket(and only to the Response bucket.)

What this means is that if you use WebPutCookie, you cannot read the Cookie
with the WebGet*Cookie functions to access the Cookie you just set because
the cookie you just set will be in the Response and is not in the Request.

I agree that the behavior can be annoying, because you may set a cookie in
one area of your code and then attempt to retrieve it in another area of
code. There are several possible solutions that you can use to this
problem.
One is to create an object that serves as both the Request & Response. For
example a Functional Class called cCookie
cCookie should have 3 methods of GetCookie, PutCookie, and Clear. The
implementation of the object such that GetCookie checks for a local array of
name/value pairs first, before calling WebGetCookie. PutCookie should add
the cookie to the local array of name/value pairs and then call
WebPutCookie. Lastly, Clear should blank the local array of namve/value
pairs and should be called from the implementation of ReusingCleanup (in
your FormWindows.)

charlie

Return to “td.web”

Who is online

Users browsing this forum: [Ccbot] and 0 guests