# WSETCOOKIE

Updated: 9/28/2020, 10:32:47 PM
Created: 9/28/2020, 10:32:47 PM
Last Updated By: Peter Schellenbach
Read Time: 1 minute(s)

The WSETCOOKIE subroutine will set a cookie to be sent back to the browser.

# WSETCOOKIE Sytax

CALL WSETCOOKIE(NAME,VALUE,EXP.DATE,EXP.TIME,PATH,DOMAIN,SECURE)
1

# Syntax Elements

Parameter Description
NAME Name of the cookie you want to set.
VALUE Value you wish to set the cookie to.
EXPDATE Date you wish the cookie to expire on.  Use PICK internal dates.
EXPTIME Time you wish the cookie to expire (used with EXPDATE).  Use PICK internal times.
PATH Path you wish the cookie to apply to.  Use / for all.
DOMAIN Domain you wish the cookie to apply to.  Use . for domain called from.
SECURE If set to Y then this cookie will only save on HTTPS requests.

# WSETCOOKIE Example

CALL WSETCOOKIE("mycookie","value",DATE(),TIME+300,"/",".","Y")
1

# WSETCOOKIE Notes

The WSETCOOKIE command basically builds a Set-Cookie header.  This function properly formats the Set-Cookie for you and understands PICK date and time formats.  If you wish more control you can use the WSETHEADER and build your own Set-Cookie line.

Here is a good link on how Set-Cookie works.