< Back

Set-PodeCookie

Sat Jan 18, 2020 7:19 pm

NAME Set-PodeCookie



SYNOPSIS

Sets a cookie on the Response.





SYNTAX

Set-PodeCookie -Name <String> [-Value <String>] [-Secret <String>] [-Duration <Int32>] [-HttpOnly] [-Discard]

[-Secure] [<CommonParameters>]



Set-PodeCookie -Name <String> [-Value <String>] [-Secret <String>] [-ExpiryDate <DateTime>] [-HttpOnly] [-Discard]

[-Secure] [<CommonParameters>]





DESCRIPTION

Sets a cookie on the Response using the "Set-Cookie" header. You can also set cookies to expire, or being signed.





PARAMETERS

-Name <String>

The name of the cookie.



Required? true

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Value <String>

The value of the cookie.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Secret <String>

If supplied, the secret with which to sign the cookie.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-Duration <Int32>

The duration, in seconds, before the cookie is expired.



Required? false

Position? named

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-ExpiryDate <DateTime>

An explicit expiry date for the cookie.



Required? false

Position? named

Default value

Accept pipeline input? false

Accept wildcard characters? false



-HttpOnly [<SwitchParameter>]

Only allow the cookie to be used in browsers.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Discard [<SwitchParameter>]

Inform browsers to remove the cookie.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



-Secure [<SwitchParameter>]

Only allow the cookie on secure (HTTPS) connections.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS



OUTPUTS

System.Collections.Hashtable





-------------------------- EXAMPLE 1 --------------------------



PS C:\\>Set-PodeCookie -Name 'Views' -Value 2













-------------------------- EXAMPLE 2 --------------------------



PS C:\\>Set-PodeCookie -Name 'Views' -Value 2 -Secret 'hunter2'













-------------------------- EXAMPLE 3 --------------------------



PS C:\\>Set-PodeCookie -Name 'Views' -Value 2 -Duration 3600















RELATED LINKS