I finally sloved using
@using Umbraco.Core;
@using Umbraco.Core.Models.Membership;
@using Umbraco.Core.Security;
var ticket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket();
if (ticket != null)
{
var userName = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket().Name;
Umbraco User Information
Can you help me please to get the Umbraco User Information in Template?
Hi Carlu,
Do you mean admin user or member?
Thanks,
Alex
I mean Admin user.
Hi carlu
Try to see Mortens answer in this thread.
https://our.umbraco.org/forum/developers/api-questions/54120-Check-if-back-office-user-is-logged-in-using-UserService
Here your will get the current backoffice user and then you can get the data from this.
Hope this helps,
/Dennis
Thank you
Hi Denis,Can you give me suggestion which namespace is required to use above code?
Hi Carlu,
The namespace that you should use when you are using one of the services. https://our.umbraco.org/documentation/Reference/Management/Services/
Namespace: Umbraco.Core.Services
Assembly: Umbraco.Core.dll
The user service is not documented yet.
Hope this helps,
/Dennis
I finally sloved using @using Umbraco.Core; @using Umbraco.Core.Models.Membership; @using Umbraco.Core.Security;
var ticket = new System.Web.HttpContextWrapper(System.Web.HttpContext.Current).GetUmbracoAuthTicket(); if (ticket != null) { var userName = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket().Name;
}
is working on a reply...