//Create a Cookie:HttpCookie myCookie = new HttpCookie(“UserId” , “xyz”); //Set Expiration DateTimemyCookie.Expires = DateTime.Now.AddDays(7);//Add Cookie to Response using Add method, shown below.Response.Cookies.Add(myCookie);