public string HelloUser()
{
string dispName = "";
Thread.GetDomain(). SetPrincipalPolicy( PrincipalPolicy. WindowsPrincipal);
using (System.Web.Hosting. HostingEnvironment. Impersonate())
{
WindowsPrincipal principal = (WindowsPrincipal)User;
PrincipalContext pc = new PrincipalContext(ContextType. Domain); ;
dispName = up.DisplayName;
}
return "Hello - " + dispName + ", your login is " + HttpContext.Current.User. Identity.Name;
}
Note: Make sure windows impersonation is turned on in IIS.
Note: Make sure windows impersonation is turned on in IIS.
No comments:
Post a Comment