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 1022 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 713 posts 4571 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 1022 karma points c-trib
    Apr 21, 2022 @ 14:27
    Martin Rud
    0

    Thanks! That was simple. :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies