Copied to clipboard

Flag this post as spam?

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

  • Rotem Orbach 121 posts 607 karma points
    Sep 02, 2020 @ 13:32
    Rotem Orbach

    Umbraco 8.2.2 - Get current user (not member) in front side website view/cshtml


    I am trying to either get the current Umbarco user (not member) in the front side of the website (inside a 'cshtm' view), or simply find if there is a User logged in.

    I understand that around V.8 using services is the way to go, so I tried based on

    IUserService userService = Services.UserService;

    But I can't find a working way to find a user.

    I tried a deep Google search and during many hours tried many other ways (some outdated or deprecated by now).

    Surely there has to be a way...

    Any help would be appreciated :)

    Many thanks,


  • Rotem Orbach 121 posts 607 karma points
    Sep 02, 2020 @ 13:54
    Rotem Orbach

    I spent hours on this... for others and for future reference, here is the answer:

    1. Make sure you use:

      @using Umbraco.Web.Security

    2. bool isLoggedin = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket() != null;

  • Steve Morgan 1324 posts 4389 karma points c-trib
    Sep 02, 2020 @ 14:04
    Steve Morgan


    I've not had to do this myself but this seems to work.

    I've no idea if it's the "proper" way.

    @using Umbraco.Web.Security
        Layout = "Master.cshtml";
        var auth = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket();

    Via RJ on

    EDIT: Cross posted with Rotem - he was first ;)

Please Sign in or register to post replies

Write your reply to: