Copied to clipboard

Flag this post as spam?

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

  • Nathan Reece 62 posts 374 karma points
    May 07, 2021 @ 03:25
    Nathan Reece

    Umbraco 8 Can I check if a user is logged in within a razor view?

    Does any one know how to check if a backend 'User' is logged in from within a razor View? I have code that checks the membership but this just seems to be working for members and not backend users. I am hoping someone can point me in the right direction.

  • David Armitage 443 posts 1842 karma points
    May 07, 2021 @ 03:44
    David Armitage

    Hi Nathan,

    This should help you.

    var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
    if (userTicket == null)
        //the user is not autenticated

    Kind Regards


Please Sign in or register to post replies

Write your reply to: