title: how to save visited page url id in same cookie .net mvc
body: <p>Hi I want to save my last visited product detail page id in one cookie. For ex.first, ı am at random tire page  and first cookie value 44 then visiting other pages url id 65 one by one. what should ı do? Can ı save them in List for cookie value because it's what ı need? thanks for helps.</p>
  
  <pre><code>       public ActionResult DetailShow(int id)
      {
          string cokvalue = ControllerContext.RouteData.Values["id"].ToString();
  
          List&lt;string&gt; view = new List&lt;string&gt;();
  
  
          foreach (var item in cokvalue)
          {
              view.Add(cokvalue);
  
  
          }
  
          **This one for What ı want to add last visited pages
  
          HttpCookie cok = new HttpCookie("last viewed");
          cok.Values["last visited"] = string.Join(",", view.ToArray());
          cok.Expires = DateTime.Now.AddMonths(1);
          Response.Cookies.Add(cok);
  
          HttpCookie mycookie = new HttpCookie("Product");
          mycookie.Values["asd"] = cokvalue;
          mycookie.Expires = DateTime.Now.AddMonths(1);
          Response.Cookies.Add(mycookie);
  
  
  
  
          var product = gelistirmeEntities.Product.Where(p =&gt; p.Product_ID == id).FirstOrDefault();
  
          return View(product);
  
      }
  </code></pre>