开发者

How can i see cookie folder

开发者 https://www.devze.com 2022-12-24 13:59 出处:网络
When i serialize a value and stored in a cookie, i can see cookie text file in Cookies folder. But if i dont serialize that value, i can\'t see cookie text file.

When i serialize a value and stored in a cookie, i can see cookie text file in Cookies folder. But if i dont serialize that value, i can't see cookie text file.

There is my code:

(Serialize)

  BinaryFor开发者_StackOverflowmatter bf = new BinaryFormatter();
  MemoryStream ms = new MemoryStream();
  bf.Serialize(ms, "111");
  byte[] bArr = ms.ToArray();
  string sCookieVal = Convert.ToBase64String(bArr);
  HttpCookie cook = new HttpCookie("cookieName");
  cook.Value = sCookieVal;
  cook.Expires = DateTime.Now.AddMinutes(20);
  HttpContext.Current.Response.Cookies.Add(cook);

(unserialize)

  HttpCookie cook = new HttpCookie("cookieName");
  cook.Value = "111";
  cook.Expires = DateTime.Now.AddMinutes(20);
  HttpContext.Current.Response.Cookies.Add(cook);

Why i can't see unserialize value in cookies folder? Where is it stored ? A phsycal path or virtual path?

Thanks for your helps.


Um, I'm not sure what you are really trying to do here. Cookies are not stored server-side, right?

It looks like you're trying to add a cookie to the response. That means that the cookie is going to be sent from the server to the client's browser that is viewing whatever ASPX this code is in.

Depending on their browser, that cookie could be stored any number of ways. I don't think serializing has anything to do with it. I'm not sure that your "serializing" code does anything. Maybe you should read more about cookies: http://en.wikipedia.org/wiki/HTTP_cookie

0

精彩评论

暂无评论...
验证码 换一张
取 消