just fig · Nov 16, 2019

how to set a expire time for a cookie?

I try to set a cookie with expire time like this:  %response.SetCookie("XXXXX",%session.SessionId,%session.AppTimeout,"","",0,0)  but when i return to the browser it shows that the cookie's("XXXXX") expire time is "session". How can i to set a expire time? Can someone help me? thxsmiley

1 0 3 160
Log in or sign up to continue

Third parameter is expire:

d %response.SetCookie("XXXXX",%session.SessionId,"expirationdate")

For example:

d %response.SetCookie("XXXXX",%session.SessionId,"Wed, 31 Oct 2020 00:00:00 GMT")

you use %session.AppTimeout which has a default of 900 (sec).

but SetCookie asks for a Time !
method SetCookie(name As %String, value As %String, expires As %String = "", path As %String = "", domain As %String = "", secure As %Boolean = 0, httpOnlyFlag As %Boolean = 0) 

I see from
what string this might be.

'Mon, 18 Nov 2019 08:50:17 GMT';

My assumption - your 900 was just not recognized and the default (=session) was set

I should learnwink to type faster