Can I access IIdentity from Web API

后端 未结 4 1954
有刺的猬
有刺的猬 2020-12-25 09:45

I\'m adding some Web API services to an existing MVC application. I have a model binder for my MVC controllers to get the user object stored in a CustomIdentity. I\'m tryi

4条回答
  •  情歌与酒
    2020-12-25 10:32

    I had the same problem and I found this way. In your ApiController you can use
    base.ControllerContext.RequestContext.Principal.Identity.;

提交回复
热议问题