System.Net.Http.HttpRequestMessageExtensions.User C# (CSharp) Method

User() public static method

Returns the IPrincipal instance authenticated and stored by the MembershipAuthenticationHandler on the ongoing request.
public static User ( this message ) : IPrincipal
message this this (request)
return IPrincipal
        public static IPrincipal User(this HttpRequestMessage message)
        {
            if (message != null)
            {
                return message.Properties[MembershipAuthenticationHandler.MessagePrincipalKey] as IPrincipal;
            }

            if (Thread.CurrentPrincipal != null)
            {
                return Thread.CurrentPrincipal;
            }

            if (HttpContext.Current != null)
            {
                return HttpContext.Current.User;
            }

            return null;
        }
HttpRequestMessageExtensions