Great, thanks Morten. Where's the best place for me to find stuff like this out? I know the documentation isn't ready yet for the User Service, but I'm struggling, as a predominantly front-ender, to get my head around the Umbraco source to uncover stuff like this. I'm getting confused by what's legacy and what's new, when to use the Service APIs and when to use .NET membership stuff, and what the code-base differences are between members and users as there seems to be some kind of overlap - it's all a bit of a pickle in my head currently. If you could point me in the right direction either in the source or somewhere else it'd be mega handy. Thanks again :)
Check if back-office user is logged in using UserService
Hi,
I'm trying to check whether a back-office user is logged in to a front-end web page. Ordinarily I'd do something like this to get the current user:
However, Visual Studio is telling me "'Umbraco.BusinessLogic.User' is obsolete. 'Use the UserService instead'".
How do I do get the current user with the new UserService?
Thanks.
Try using the UmbracoContext like this:
If you are using an UmbracoApiController you will already have the WebSecurity instance available, so you can just do:
Hope this helps.
Great, thanks Morten. Where's the best place for me to find stuff like this out? I know the documentation isn't ready yet for the User Service, but I'm struggling, as a predominantly front-ender, to get my head around the Umbraco source to uncover stuff like this. I'm getting confused by what's legacy and what's new, when to use the Service APIs and when to use .NET membership stuff, and what the code-base differences are between members and users as there seems to be some kind of overlap - it's all a bit of a pickle in my head currently. If you could point me in the right direction either in the source or somewhere else it'd be mega handy. Thanks again :)
is working on a reply...