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.