Cookies in ASP.NET Core rc2

后端 未结 1 939
生来不讨喜
生来不讨喜 2021-01-20 16:06

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.Cookie

相关标签:
1条回答
  • 2021-01-20 16:24

    For getting request cookie value:

    HttpContext.Request.Cookies["<key>"]
    

    Setting response cookie:

    HttpContext.Response.Cookies.Append("<key>", <value>, <options?>)
    
    0 讨论(0)
提交回复
热议问题