Answers for "how to get the cookie value inside mvc 5 controller"

C#
0

how to get the cookie value inside mvc 5 controller

/*SM*/
//will reset the search cookie
HttpCookie cookie = new HttpCookie("search");

//To get a cookie:
HttpCookie cookie = HttpContext.Request.Cookies.Get("some_cookie_name");

//To check for a cookie's existence:
HttpContext.Request.Cookies["some_cookie_name"] != null
  
//To save a cookie:
HttpCookie cookie = new HttpCookie("some_cookie_name");
HttpContext.Response.Cookies.Remove("some_cookie_name");
HttpContext.Response.SetCookie(cookie );
Posted by: Guest on July-03-2021

Code answers related to "how to get the cookie value inside mvc 5 controller"

C# Answers by Framework

Browse Popular Code Answers by Language