The question is quite straightforward:

How to replace a HttpCookie in MVC3? (Assuming we have access to the HttpContext instance)

有帮助吗?

解决方案

Use SetCookie

var cookie = Request.Cookies["cookieName"];
if (cookie != null)
{
    cookie.Value = "new value";
    Response.SetCookie(cookie);
}
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top