c# - How to use "User.Identity.IsAuthenticated" in Web API -


user.identity.isauthenticated returns false in asp.net web api project.

in account apicontroller have following:

claimsidentity identity = new claimsidentity(claims, defaultauthenticationtypes.applicationcookie);  authenticationmanager.signin(new authenticationproperties() {      ispersistent = ispersistent  }, identity); 

after signing in, user.identity.isauthenticated false in apicontroller true in mvc controller.

it's unable use httpcontext property directly in apicontroiller. , have make use of request property of type system.net.http.httprequestmessage. httprequestmessage has properties dictionary; find value of key ms_userprincipal holds iprincipal object.


Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -