Interestingly this does not work again in all instances. This still returns null when calling from a user control that is used in the backoffice. However it does work in other scenarios.
If you inherit from Umbraco.Web.UI.Controls.UmbracoUserControl instead, it will give you easier ways to access the various service APIs + an instance of UmbracoHelper is available (called "Umbraco").
Getting Current Backend User
Hi All,
I am trying to get the logged in backoffice user. I have used the code below but it seems to work in some instances but not all.
To slightly complicate matters a backoffice user may also be logged in as a member at the sametime.
Any help would be appreciated!
Regards L
Hi L,
Try using
UmbracoContext.Current.Security.CurrentUser
to get the current back-office user.Cheers,
- Lee
Hi Lee,
That seems to be working, thank you kindly!
Regards, L
You're welcome. Don't forget to mark the solution, (it helps others for future reference).
Thanks,
- Lee
Hiya
Interestingly this does not work again in all instances. This still returns null when calling from a user control that is used in the backoffice. However it does work in other scenarios.
Any ideas why? or other solutions?
Regards, L
Hi L,
Does your user-control inherit from
Umbraco.Web.UI.Controls.UmbracoUserControl
?If so, then you should be able to use
Security.CurrentUser
directly.Cheers,
- Lee
Actually I was just inheriting
System.Web.UI.UserControl
Would it be bestr to inheritUmbraco.Web.UI.Controls.UmbracoUserControl
?Thank you for your help, Regards L
If you inherit from
Umbraco.Web.UI.Controls.UmbracoUserControl
instead, it will give you easier ways to access the various service APIs + an instance ofUmbracoHelper
is available (called "Umbraco").Comment author was deleted
Connecting an issue here as I eventually ran into a
null
user from a RenderMVC controller.http://issues.umbraco.org/issue/U4-6496
The link above provides a workaround if needing to know from the frontend if a user is logged into the backoffice or not.
is working on a reply...