Environment.UserName returning application pool name instead of username

前端 未结 4 756
后悔当初
后悔当初 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 08:01

    Try using

    Request.ServerVariables["LOGON_USER"]
    

    It will return DOMAIN\USERNAME. You can then split it etc.

提交回复
热议问题