I ran into a problem on localhost, and in Chrome and Firefox , not Edge
this code will work fine and set a cookie:
[HttpPost] public ActionResult Change(string val) { var cookie = new HttpCookie(CookieName) { Value = val, Expires = DateTime.Now.AddYears(1) }; Response.Cookies.Add(cookie); return Content(""); }
however, if I change Expires to just 300 days , the cookie will not be sent back to Request Cookies , (it will still appear in Response Cookies for a Change request)
Edit: this action is called via jquery ajax ( $.post ); and he worked, perhaps six months ago.
Omu
source share