Do you want to hide template or page in the backoffice for some user?
You can use this method for getting user:
var userTicket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
if (userTicket != null)
{
var currentUser = ApplicationContext.Services.UserService.GetByUsername(userTicket.Name);
}
This looks like what I need, but I am getting this error.
CS1061: 'System.Web.HttpContextWrapper' does not contain a definition for 'GetUmbracoAuthTicket' and no extension method 'GetUmbracoAuthTicket' accepting a first argument of type 'System.Web.HttpContextWrapper' could be found (are you missing a using directive or an assembly reference?)
Restrict front end page to user who has logged into the back end.
Hi all
Please could someone tell me how I can restrict a front end page (Template) to a user who has logged into the back end as an Umbraco user?
Thanks
Paul
Hi Paul,
Do you want to hide template or page in the backoffice for some user?
You can use this method for getting user:
Thanks,
Alex
Thank Alex.
This looks like what I need, but I am getting this error.
CS1061: 'System.Web.HttpContextWrapper' does not contain a definition for 'GetUmbracoAuthTicket' and no extension method 'GetUmbracoAuthTicket' accepting a first argument of type 'System.Web.HttpContextWrapper' could be found (are you missing a using directive or an assembly reference?)
Hi Paul,
Add please these:
Hope it will help.
Thanks,
Alex
That worked perfectly. Thanks Alex.
Kind regards
Paul
This was the final piece I needed for a Mini package I'm going to release. I will give you credit in the description.
Kind regards
Paul
So nice to hear, thank you very much and have a successful release!
Alex
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.