[ardoHTTP] Cookie

Forge Component
(19)
Published on 20 Jan by Ricardo Silva
19 votes
Published on 20 Jan by Ricardo Silva

Hi,


is there a way of retrieving the cookies of the response, say from the HTTPPost ?

Yes, Responses have the list of headers. The cookies are headers which are sent back, so the cookies are in the response headers list :)

Hi.. 

I want to get the "expires" value of a cookie in the server.. 

The action GetCookie from HTTPRequestHandler returns only the cookie value..

And with this ardoHTTP extension I know that we can get the headers of original request but the cookie Header sends only the values of each cookie.. so we would need to use HTTPPost to get some Response Headers that includes the entire information of each cookie.. 

Is there a way to get the this value without making an extra HTTP request to the server ?

Cheers,
Tiago

Tiago Lopes wrote:

Hi.. 

I want to get the "expires" value of a cookie in the server.. 

The action GetCookie from HTTPRequestHandler returns only the cookie value..

And with this ardoHTTP extension I know that we can get the headers of original request but the cookie Header sends only the values of each cookie.. so we would need to use HTTPPost to get some Response Headers that includes the entire information of each cookie.. 

Is there a way to get the this value without making an extra HTTP request to the server ?

Cheers,
Tiago

You can't.

The only way to see the expiry date of a cookie is in the browser itself, because the browser doesn't send that information to the server, and it's also not accessible using JavaScript.

The only way around this is to set the expiry date as part of the value itself.


Thanks for your response Carlos..

I know browsers don't send cookies Expire time to server but these cookies are created in the server at first instance.. and the server saves this information..

The limitation here is that GetCookie action from HTTPRequestHandler extension only returns the value.. and not the Expire time..

C# code for this is as simple as this:

Request.Cookies["YourCookie"].Expires.ToString();

I'm just wondering why there's no easy way to get this information with any Outsystems extension..

I didin't want to do a .XIF only for this but maybe it's the only solution..