Creating a Cookie in ASP.NET
#region Creating CookiesHttpCookie JayaCookie = Request.Cookies["CookieExample"];
if (HttpContext.Current.Request.Cookies["CookieExample"].Value == null)
{
HttpContext.Current.Response.Cookies["CookieExample"].Value = Session.SessionID;
HttpContext.Current.Response.Cookies["CookieExample"].Expires = DateTime.Now.AddYears(30);
}
#endregion
For the above Example the cookie name is "CookieExample".I assigned the SessionID value to the cookie
No comments:
Post a Comment