Creating a Cookie on the User’s machine for 1 months using C#.

Posted by Vishalneeraj-24503 under ASP.NET category on | Points: 40 | Views : 962
Write below query:-
HttpCookie UsrDet = new HttpCookie();

//Add the values into cookie
UsrDet["Name"] = "John";
UsrDet["Desig"] = "Project Manager";
UsrDet["Age"] = "30";
UsrDet["Sal"] = "0.0";
UsrDet["Place"] = "UK";

//Set the cookie expire details
UsrDet.Expires = DateTime.Now.AddDays(30);

//Add to the collection

Comments or Responses

Login to post response