1

I have found legacy code in API controllers.

var user = await _userService.FindAsync(x => x.UserName == Thread.CurrentPrincipal.Identity.Name);
if (user == null) return NotFound();

I don't know when I should use Thread.CurrentPrincipal.Identity.Name instead of simple this.User.Identity.GetUserId().

What is difference?

Josh Crozier
  • 233,099
  • 56
  • 391
  • 304
Mediator
  • 14,951
  • 35
  • 113
  • 191
  • 1
    I think [this answer](http://stackoverflow.com/a/3057979/706456) is what you are after. One will be an account of OS system where the thread is running. The other one will be web user identity. – oleksii Sep 14 '15 at 11:34

0 Answers0