Environment.UserName returning application pool name instead of username

前端 未结 4 745
后悔当初
后悔当初 2021-01-05 06:57

The following line

Environment.UserName

In debug mode in visual studio returns the identity of the user like I need.

Then when I se

4条回答
  •  有刺的猬
    2021-01-05 07:43

    This worked for me. Use Environment.GetEnvironmentVariable("USERNAME") for current Login username.

    Link :https://www.c-sharpcorner.com/uploadfile/puranindia/the-environment-class-in-C-Sharp/

提交回复
热议问题