Content Studio Web Content Management System
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
If the cookie contains other sub-cookies they will be preserved but the all will all expire at the same date.
The following example shows how to set a persistent cookie with a sub-cookie that lasts for a month and obtain its value with the GetCookie(String) method
[This is preliminary documentation and is subject to change.]
Sets the value of an HTTP cookie with a specific expiration value.
Namespace: ContentStudio.Site
Assembly: CS_SiteLib (in CS_SiteLib.dll) Version: 5.7.5016.0 (5.7.5016.0)
Syntax
public void SetCookie( string cookieName, string subCookieName, string value, DateTime expires )
Parameters
- cookieName
- Type: SystemString
The name of the cookie - subCookieName
- Type: SystemString
The name of the sub-cookie - value
- Type: SystemString
The value to set - expires
- Type: SystemDateTime
A value that indicates when the cookie should expire
Remarks
Examples
const string COOKIE = "MyCookie"; const string SUBCOOKIE = "SubCookie"; DateTime ExpiresDate = DateTime.Now.AddMonths(1); SetCookie(COOKIE, SUBCOOKIE, "Cookie & sub-cookie", ExpiresDate); Response.Write(Server.HtmlEncode(GetCookie(COOKIE));
See Also