Current user Active Directory
Posted on 2008-06-17
I have a network with Active Directory and I want to response.write (which means store in a session) the current logged in user to a Intranet webpage. If the user is logged in with DOMAIN\UserN on windows logon, that username should be showed on the webpage.
If I got that username, I can also take out other stored variables on the user? Like Telephone Number?
Maybe also extensionAttribute1 from Exchange Advanced tab on the user? (not important)
There exist a huge list of answers on this question but nobody seems to fit in, really complex or does not works as I want. In a Access database I've use a simple solution as this below, but does of course not work in ASP.NET environment.
Dim cmdBaseCon As New ADODB.Command
.ActiveConnection = CurrentProject.BaseConnectionString
.CommandType = adCmdStoredProc
.CommandText = "proc_GetCurrentUserSS"
.Parameters(0).Direction = adParamReturnValue
.Parameters(1).Direction = adParamOutput
GetCurrentUser = Nz(.Parameters(1), "No username returned")