Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Martin Rud 261 posts 1002 karma points c-trib
    Apr 21, 2022 @ 12:52
    Martin Rud
    0

    How to read a cookie in Umbraco 9/.NET Core?

    Hi forum,

    I need to read a cookie from a view. How do I do that in .NET Core?

  • Søren Kottal 712 posts 4570 karma points MVP 6x c-trib
    Apr 21, 2022 @ 13:11
    Søren Kottal
    101
    @{
    Context.Request.Cookies.TryGetValue("NameOfCookie", out string cookieValue);
    }
    

    You then have the value in @cookieValue

  • Martin Rud 261 posts 1002 karma points c-trib
    Apr 21, 2022 @ 14:27
    Martin Rud
    0

    Thanks! That was simple. :)

Please Sign in or register to post replies

Write your reply to:

Draft