Can someone pls explain how to store and get cookies in an ASP.NET Core rc2 application? I can only find outdated information about the old HttpContext.Response.Cookies.Get
and Add
methods, neither of which still exist in Core. Also, the HttpCookie
class doesn't seem to exist either.
What is the new cookie class and how can I get and add one?
(Note: I am not specifically taking about authentication cookies, just general data cookies)
For getting request cookie value:
HttpContext.Request.Cookies["<key>"]
Setting response cookie:
HttpContext.Response.Cookies.Append("<key>", <value>, <options?>)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With