Where can I find the cookie on the client side

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
 
A

Arne Vajhøj

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

Arne Vajhøj

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top