Access Umbraco back office user from the front end

If you need to access the current user logged into the Umbraco Backoffice from the Front End (to show a link to administrator area for example) you may have tried:


None of which seem to work, then you should user the following code:

var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
if (userTicket != null) {     
 var currentUser = ApplicationContext.Services.UserService.GetByUsername(userTicket.Name);

As Andrew Wilson mentions in the comments, remember to include Umbraco.Core.Security – though if you forget hopefully Visual Studio will tell you to add it.

3 thoughts on “Access Umbraco back office user from the front end

  1. Good solution, don’t forget to include:

    @using Umbraco.Core.Security;

  2. +1
    Belongs in a hall of fame for useful Umbraco hacks. 😉

  3. Hey GR 😉

    Handy tip this. Cheers for posting

Leave a Reply

Your email address will not be published. Required fields are marked *