public static void WriteCookie(String name, String value, Int32 days) { string expires = ""; if (days > 0) { Date date = new Date(); date.SetTime(date.GetTime() + (days * 24 * 60 * 60 * 1000)); expires = "; expires=" + date.ToUTCString(); } Document.Cookie = name + "=" + value + expires + "; path=/"; }