ASP.NET Getting Current User Name

后端 未结 8 621
猫巷女王i
猫巷女王i 2021-01-12 10:57

I am trying to build an application on our company\'s intranet using ASP.NET and VB.NET.

Neither of these functions return anything once my application is published

8条回答
  •  没有蜡笔的小新
    2021-01-12 11:36

    If domain and username specified something like "DOMAIN\username" in AD

    HttpContext.Current.User.Identity.Name.Split('\\')[0] returns the Domain

    and

    HttpContext.Current.User.Identity.Name.Split('\\')[1] returns the username

提交回复
热议问题