Get currently logged in Active Directory user name in ASP.NET

I want to get currently logged in active directory user name/details.Here, User does log in to machine with its AD username and password. How can i get this user name and other details in Global.asax file for Application_AuthenticateRequest() Event.I have used System.Security.Principal.WindowsIdentity.GetCurrent().Name OR HttpContext.User.Identity.Name, it gives proper AD User.But, when it hosted on IIS 6.0 or 5.0 returns Server's users credentials. such as "domain\username". I have currently enabled Anonymous Access and Integrated Authentication. And in project using Form Authentication.Should I use System.Directory.dllOne More Thing, I am using personalization setting in my application, If I changed it to Windows Authentication, it gives error "Personalization not enabled" and when I change it to Form Authentication in Application, it works but again restores IIS user name provided that Anonymous is Enabled. If I disable it It ask for user name and password for accessing application that I don't want. Any help greatly anticipated
 
Back
Top