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 have written a web service in an asmx file (stored under Umbraco\WebServices) and use methods I have in a class in a separate cs file.
I would like to access the Umbraco loggedin user id - so in my calls I am
var authenticationTicket = new HttpContextWrapper(HttpContext.Current).GetUmbracoAuthTicket();
IUser user = null;
if (authenticationTicket != null)
user = UmbracoContext.Current.Application.Services.UserService.GetByUsername(authenticationTicket.Name);
// not logged into backoffice
// use it if not null
var lUserId = "";
if(user != null)
lUserId = user.Id.ToString();
This is actually returning the logged in user, which suggests that the web service is part of the main application session and has access to HttpContext.
My question is - is this reliable, ie is the web service always going to be able to query HttpContext, or is this going to be flaky?
is working on a reply...
Write your reply to:
Image will be uploaded when post is submitted