IUser currentUser = null;
var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
if (userTicket != null)
{
currentUser = ApplicationContext.Services.UserService.GetByUsername(userTicket.Name);
}
var uu = umbraco.helper.GetCurrentUmbracoUser();
None of the above code yields any type of indicating that I am also currently logged into the backoffice. Anyone have any other ideas as to how to get this to work?
Access Umbraco back office user from the front end
I have a few pages that the product owner wants to ensure that the user is logged into the back office when accessing the page.
I have searched around for several hours and have not been able to find a solution that works directly in the razor markup
Below are a few of the things I have tried:
var userService = ApplicationContext.Current.Services.UserService;
var b = umbraco.BusinessLogic.User.GetCurrent(); var user = UmbracoContext.Current.Security.CurrentUser;
//var user2 = userService.GetByUsername(HttpContext.Current.User.Identity.Name).Id;
IUser currentUser = null; var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket(); if (userTicket != null) { currentUser = ApplicationContext.Services.UserService.GetByUsername(userTicket.Name); }
var uu = umbraco.helper.GetCurrentUmbracoUser();
None of the above code yields any type of indicating that I am also currently logged into the backoffice. Anyone have any other ideas as to how to get this to work?
Why you want access User Back Office from Front End?
Maybe no way to Access this!
For a specific page, made a custom attribute Authorize and created a RenderMvcController
UPDATE: You can also try to use the IsBackOffice attribute
Thanks Marcio… just what I needed :-)
is working on a reply...