How to get user name using Windows authentication in asp.net?

前端 未结 7 1870
抹茶落季
抹茶落季 2020-12-23 11:43

I want to get user name using Windows authentication

Actually I implemented \"Sign in as different user\",when click this button Windows security will appear there w

7条回答
  •  清酒与你
    2020-12-23 12:27

    You can read the Name from WindowsIdentity:

    var user = System.Security.Principal.WindowsIdentity.GetCurrent().Name;
    return Ok(user);
    

提交回复
热议问题