Frequently Asked Interview Questions

How can you create Persistent Cookies?


//Create a Cookie:
HttpCookie myCookie = new HttpCookie(“UserId” , “xyz”);

//Set Expiration DateTime
myCookie.Expires = DateTime.Now.AddDays(7);

//Add Cookie to Response using Add method, shown below.
Response.Cookies.Add(myCookie);

Most Visited Pages

Home | Site Index | Contact Us