2

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
  • 219,308
  • 53
  • 366
  • 287
Mediator
  • 14,387
  • 34
  • 108
  • 180
  • 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