Asp.Net getting users UPN from Active Directory
Posted on 2013-02-06
Running a .net web app and am truing to get the currently logged in users User Principal Name from AD.
I'm using the System.DirectoryServices.AccountManagement.UserPrincipal.Current property to achieve this...
I understand that I need to run the application as a user that has read access to AD, but am not sure how my web.conf file should be set up to achieve this..
I currently have...
... in my web.conf and the nominated user has read access to AD, the problem is that it always reports this users UPN and not the user that's actually running the application...
I know this is a bit obvious, but I'm struggling to get the web application to run in the context as the actual user who is calling the application..
If I remove the userName/password from that tag, i get the following error...
Can someone de-mystify this for me please??
Thanks in advance..