jgd1234567
Programmer
Hi, i'm having some problems updating cookies. I have the following code when a user submits a comment:
Response.Cookies["Comment"]["FullName"] = txtFullName.Text;
Response.Cookies["Comment"]["Email"] = txtEmail.Text;
Response.Cookies["Comment"]["Url"] = txtUrl.Text;
Response.Cookies["Comment"].Expires = DateTime.Now.AddYears(1);
And then in my page load i have:
if (Request.Cookies["Comment"] != null)
{
txtFullName.Text = Request.Cookies["Comment"]["FullName"];
txtEmail.Text = Request.Cookies["Comment"]["Email"];
txtUrl.Text = Request.Cookies["Comment"]["Url"];
}
The first time i post a comment the cookie is successfully set but if i post a new comment and change one of values the cookie doesn't get updated.
I have just read the msdn documentation and it suggests that my could should work for both creating and updating the cookie but it doesn't seem to update.
Appreciate your help. Thanks
Response.Cookies["Comment"]["FullName"] = txtFullName.Text;
Response.Cookies["Comment"]["Email"] = txtEmail.Text;
Response.Cookies["Comment"]["Url"] = txtUrl.Text;
Response.Cookies["Comment"].Expires = DateTime.Now.AddYears(1);
And then in my page load i have:
if (Request.Cookies["Comment"] != null)
{
txtFullName.Text = Request.Cookies["Comment"]["FullName"];
txtEmail.Text = Request.Cookies["Comment"]["Email"];
txtUrl.Text = Request.Cookies["Comment"]["Url"];
}
The first time i post a comment the cookie is successfully set but if i post a new comment and change one of values the cookie doesn't get updated.
I have just read the msdn documentation and it suggests that my could should work for both creating and updating the cookie but it doesn't seem to update.
Appreciate your help. Thanks