Accessing Employee ID via LDAP in a Classic ASP/VBScript application -


I am maintaining an old ASP / VBScript that I have / upgrade and its currently getting an app using the old has / depreciation of gathering instrument profile information - like below:

  strNTUser = Request.ServerVariables ( "AUTH_USER") instead of strNTUser = (strNTUser, "\", "/") Set the strNTUserInfo = GetObject ("WinNT: //" + strNTUser) 'You get this idea' ' 

When I needed all the full name and description, it was ok. Now I need to access some additional profile information, but I have to use LDAP instead of WinNT. I was blind until I am Google, but for my life I can not connect my LDAP and connect my mind about getting the information that I need.

Update : What I need to do is get the first name, last name, and employee ID to get it based on AUTH_USER: I started that ADSI Or something similar would be required from the interface, but I am apparently an ADIOD and I am not getting any useful hint - alone help - from anything found on MSDN or TechNet. The more obvious help would be ...

I'm sure that maybe a little more efficient way to do this but here's the code I ended up using search trying much later, and the gnashing of teeth ...

  dim strNTUser, strUser, strDN, strRootTDSE dim objRootDSE, objConnection, objCommand , objRecordSet, objUser, objNTUserInfo strNTUser = Request.ServerVariables ( "AUTH_USER") strUser = Middle (strNTUser, (instr (1, strNTUser, "\") + 1), lane (strNTUser)) set objConnection = Server.CreateObject ( " ADODB Connection ") set objCommand = Server.CreateObject (" ADODB.Command ") ObjConnection.Provider = "ADsDSOObject" objConnection.Open set "Active Directory Provider" objCommand.ActiveConnection = objConnection objCommand.Properties ("Page Size") = 1000 'ObjCommand.Properties ("SearchScope") = 2' ADS_SCSP_STEE Set ObjectivitySDE = GetObject set ( "LDAP: // Rutdisi") strRootTDSE = objRootDSE.Get ( "Difoltonmingcontekst") to objRootDSE = nothing JCommand.CommandText = _ "select Fistingu Number of LDAP: //" & amp; StraftTDSE & amp; "'" & "Amp" _ "Where the object class = 'user' and sAMAccountName = '' & amp; Strauss and amp;" ' "Set objRecordSet = objCommand.Execute when objRecordSet.EOF so objRecordSet.MoveFirst if not objRecordSet.BOF strDN = objRecordSet set .Fields ( "distinguished name"). value end objConnection = nothing set objCommand = nothing set objRecordSet = nothing ObjUser = GetObject ( "LDAP: //" and strDN) set 'I no longer receive details I can use the objuser to do ' 

I will accept any refactor code with pleasure, And because of this, now I have to reduce the "basic authentication" site to work.

As a side note, I've probably given up the hard code, so I can send it back I've got the original code for Open Source Project.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -