title: c# cookie cannot convert type 'string' to 'x'
body: <p>I have this cod:</p>
  
  <pre><code> [Serializable]
      public class testC
      {
          string sir;
          public testC()
          {
              sir = string.Empty;
          }
          public string GetString
          {
              get { return sir; }
              set { sir = value; }
  
          }
      }
  public class cookieTest
      {
          testC test;
          public cookieTest()
          {
              test = new testC();
          }
          public testC GetTestC
          {
              get
              {
                  HttpCookie cookie = HttpContext.Current.Request.Cookies["test"];
                  test = cookie["first"] as testC;
                  return test;
              }
              set
              {
                  HttpCookie cookie = new HttpCookie("test");
                  cookie.Expires = DateTime.Now.AddHours(8);
                  cookie["first"] = value.ToString();
                  System.Web.HttpContext.Current.Response.Cookies.Add(cookie);
              }
          }
      }
  </code></pre>
  
  <p>And i get this error </p>
  
  <blockquote>
    <p>Cannot convert type 'string' to 'testC' via a reference conversion,
    boxing conversion, unboxing conversion, wrapping conversion, or null
    type conversion</p>
  </blockquote>
  
  <p>Is possible to get the object from cookie? Or I must to write into cookie all my data to set and  get all data and create a new object to get?</p>