I canβt switch to all new service providers, authentication, etc. So, I am running a hybrid script and it works fine.
To get the current user in the service, I do this:
private IPrincipal CurrentUser() { var context = HttpContext.Current; if (context != null) { var user = context.User; if (user != null) { if (!user.Identity.IsAuthenticated) return null; return user; } } return null; }
Is there an alternative / best way to get the current HTTP context directly from the service? I would prefer not to use HttpContext.Current if I don't need to?
source share