Pregunta

The question is quite straightforward:

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

¿Fue útil?

Solución

Use SetCookie

var cookie = Request.Cookies["cookieName"];
if (cookie != null)
{
    cookie.Value = "new value";
    Response.SetCookie(cookie);
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top