How to get at the current users windows identity

前端 未结 5 1629
刺人心
刺人心 2020-12-11 02:57

The site is running on my local IIS 6.1. I Would like to add some features to pull information from our AD. My AD code works on many other projects and on my dev server. Her

5条回答
  •  我在风中等你
    2020-12-11 03:53

    HttpContext.Current.User.Identity may be of use to you here.

    Likewise System.Threading.Thread.CurrentPrincipal could help.

    But the case might be that you actually have to set an identity instance as the user logs in (though not necessarily implement IPrincipal and the surrounding mechanisms, rather using the built-in WindowsIdentity implementation).

    I'm not 100% percent on this, Windows Authentication might set this automatically for you to simply retrieve.

    Also, check out this link from MSDN which describes basic user operations,

提交回复
热议问题