Posted on: 7/18/2014 8:46:30 AM | Views : 416

Hi Experts,
In my Asp.Net intranet application, whenever user open a web site link, I want to get the LoginId of the currently logged user on the client machine and with this LoginId I want to get the emailaddress from AD. I do not want show the window popup. instead I want to pick up the LoginId of client machine and perform further. See the code below. Can you tell me the settings I have to do to make it works.  I made Authentication mode="Windows".
Thanks in advance
using (var dssearch = new DirectorySearcher("domainname")) { dssearch.Filter = string.Format("(sAMAccountName={0})", User.Identity.Name.Split('\\')[1]); var sresult = dssearch.FindOne(); if (sresult != null) { using (dsresult = sresult.GetDirectoryEntry()) { str = dsresult.Properties["mail"].Value.ToString(); } } } Go to the complete details ...