I'm trying to do a “get” of a page, and pass in a list of ids that is stored in my cookie. My assumption was that it would be possible to get the cookie with the list from my request. However, I don’t get the cookie on the server side as I would expect. I only get a “user” cookie, but that doesn’t contain my info.
I want to try to avoid actually passing these values in the URL as I'm trying to keep as clean and nice URL's as possible. However, if it isn't possible in any other way, then I can still do it.
Adding the cookie:
function setCookie(name, value) {
var today = new Date();
today.setTime(today.getTime());
var expires = 30 * 1000 * 60;
var c_name = name;
var exdate = new Date(today.getTime() + (expires));
document.cookie = c_name + "=" + value + ";expires=" + exdate.toGMTString();
}
Getting the new page in jQuery:
document.location.href = href;
In my Action Method:
if (Request.Cookies != null)
{
var myCookie = Request.Cookies[cookieName];
}
//myCookie is always null
Shouldn't a cookie I add, still be accessible in the Request?
Edit:
When I've now used FireBug and FireCookie, I can see that the cookie is not passed with the request. So the question is if I do something wrong when adding the cookie?