Where can I find the cookie on the client side

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

I have run this code and made a search in all files after myval but haven't
find one.
I use Windows XP and VS 2008 and run from within VS2008 the built in web
develoment server.
So where can I find this cookie file ?

protected void buttonSubmit_Click(object sender, EventArgs e)
{
string myval = "myval";
HttpCookie cookie = new HttpCookie("mycookie");
cookie.Values.Add("mystate", myval);
Response.Cookies.Add(cookie);
}

//Tony
 
I have run this code and made a search in all files after myval but haven't
find one.
I use Windows XP and VS 2008 and run from within VS2008 the built in web
develoment server.
So where can I find this cookie file ?

protected void buttonSubmit_Click(object sender, EventArgs e)
{
string myval = "myval";
HttpCookie cookie = new HttpCookie("mycookie");
cookie.Values.Add("mystate", myval);
Response.Cookies.Add(cookie);
}

A cookie with no expiration is only kept for the session,
so the browser has no reason to persist it on disk.

Cookies with expiration's has to be persisted and are
stored where the browser stores its cookies.

Arne
 
A cookie with no expiration is only kept for the session,
so the browser has no reason to persist it on disk.

Cookies with expiration's has to be persisted and are
stored where the browser stores its cookies.

Try play with this little demo:

<script language="C#" runat="server">
void Page_Load(Object sender, EventArgs e)
{
HttpCookie reqcookie = Request.Cookies["mystate"];
lbl.Text = reqcookie != null ? reqcookie.Value : "(not set)";
HttpCookie respcookie = new HttpCookie("mystate", "myvalue");
// out comment to persist cookie
respcookie.Expires = DateTime.Now.AddMinutes(10);
Response.Cookies.Add(respcookie);
}
</script>
<form runat=server>
<asp:label id="lbl" runat="server"/>
</form>

Arne
 
Back
Top