Press Ctrl / CMD + C to copy this to your clipboard.
This post will be reported to the moderators as potential spam to be looked at
I am trying to either get the current Umbarco user (not member) in the front side of the website (inside a 'cshtm' view), or simply find if there is a User logged in.
I understand that around V.8 using services is the way to go, so I tried based on
IUserService userService = Services.UserService;
But I can't find a working way to find a user.
I tried a deep Google search and during many hours tried many other ways (some outdated or deprecated by now).
Surely there has to be a way...
Any help would be appreciated :)
I spent hours on this... for others and for future reference, here is the answer:
Make sure you use:
bool isLoggedin = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket() != null;
I've not had to do this myself but this seems to work.
I've no idea if it's the "proper" way.
Layout = "Master.cshtml";
var auth = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket();
Via RJ on https://our.umbraco.com/forum/umbraco-8/96524-show-content-for-backend-admin-only
EDIT: Cross posted with Rotem - he was first ;)
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted