I'm seeing something of an oddity when setting a cookie...
Action:
string cookieName = "foo";
string cookieValue = "bar";
//Set a cookie in the response, along with the Expires.
this.ControllerContext.HttpContext.Response.Cookies.Add(
new HttpCookie(cookieName, cookieValue)
{
Expires = DateTime.Now.AddHours(1)
}
);
When debugging, I can see that this new cookie has an expiry of one hour in the future, and yet, when I look at the cookie in the view, the expiry isn't there...
View:
<%= Request.Cookies.Get("foo").Value %>
Returns bar
.
<%= Request.Cookies.Get("foo").Expires %>
Returns 01/01/0001 00:00:00
Any ideas?!