GetCookie is always blank

GetCookie is always blank

  
I'm using version 9 of ServiceStudio and seem to have an issue with GetCookie.  In my preparation, I'm either doing a SetCookie or a GetCookie; not both in the same event.  The SetCookie works (path and domain are blank) and I was able to find it using a Cookies extension in Chrome.  But if I do the GetCookie with the CookieName, the value always comes back blank even though I see a value in Chrome.  The expiration date for the cookie is Dec 12 2014 (1 month from today).  

Thanks for any help.

Update: I was able to create a simple application and the get/set cookie works great.  Is there something in an application (a setting) that might mess this up?
So it seems that if I add "/" for the CookiePath in SetCookie, and "" for the domain, the GetCookie works.  What I liked about leaving the CookiePath blank was that the cookie seemed to only be for that application; and not for the domain.   

???

2 years after, I'm having the same problem that David had.


GetCookie was always returning an empty value but if I put the CookiePath as "/" instead of empty (that by default puts the Application Path) the GetCookie works fine.


Can anyone explain this behaviour?


Thanks,

Francisco Martin wrote:

2 years after, I'm having the same problem that David had.


GetCookie was always returning an empty value but if I put the CookiePath as "/" instead of empty (that by default puts the Application Path) the GetCookie works fine.


Can anyone explain this behaviour?


Thanks,


I've had the same issue just now. Lucky to find this post and get it working.


It would be nice if Outsystems would update their documentation to reflect the proper usage of the CookiePath attribute.

Francisco Martin wrote:

2 years after, I'm having the same problem that David had.


GetCookie was always returning an empty value but if I put the CookiePath as "/" instead of empty (that by default puts the Application Path) the GetCookie works fine.


Can anyone explain this behaviour?


Thanks,

Hi Francisco,


If you look at the SetCookie code you'll understand why if you use empty, it will use the application path

(...)
            if (ssCookiePath.Length != 0) {
                oCookie.Path = ssCookiePath;
            } else {
                oCookie.Path = "/" + AppInfo.GetAppInfo().eSpaceName + "/" + AppInfo.GetAppInfo().PtaPath;

(...)

Filipe Martins wrote:

Francisco Martin wrote:

2 years after, I'm having the same problem that David had.


GetCookie was always returning an empty value but if I put the CookiePath as "/" instead of empty (that by default puts the Application Path) the GetCookie works fine.


Can anyone explain this behaviour?


Thanks,

Hi Francisco,


If you look at the SetCookie code you'll understand why if you use empty, it will use the application path

(...)
            if (ssCookiePath.Length != 0) {
                oCookie.Path = ssCookiePath;
            } else {
                oCookie.Path = "/" + AppInfo.GetAppInfo().eSpaceName + "/" + AppInfo.GetAppInfo().PtaPath;

(...)

Can some one guide on where to find such code snippets. I feel understanding the platform from its own back-end would be very helpful rather than just working on the surface.


Thanks


Ashish Sarwal wrote:

Filipe Martins wrote:

Francisco Martin wrote:

2 years after, I'm having the same problem that David had.


GetCookie was always returning an empty value but if I put the CookiePath as "/" instead of empty (that by default puts the Application Path) the GetCookie works fine.


Can anyone explain this behaviour?


Thanks,

Hi Francisco,


If you look at the SetCookie code you'll understand why if you use empty, it will use the application path

(...)
            if (ssCookiePath.Length != 0) {
                oCookie.Path = ssCookiePath;
            } else {
                oCookie.Path = "/" + AppInfo.GetAppInfo().eSpaceName + "/" + AppInfo.GetAppInfo().PtaPath;

(...)

Can some one guide on where to find such code snippets. I feel understanding the platform from its own back-end would be very helpful rather than just working on the surface.


Thanks



Hi Ashish,

As SetCookie is an action from the HTTPRequestHandler extension, you can check it's code by opening the extension through Integration Studio and then check the .NET code in Visual Studio. I believe there are training videos explaining that.

Hope this helps.

Cheers,