Hello Derek,
We don’t record our meetings currently. Nobody wants to watch us eat. Here’s the code I’m using for active directory login. Note that this is an Intranet application that is behind a firewall. If you’re making it public facing, I’d throw in all sorts of additional validations. I hope this helps.
[code]Dim strUser, strPassword, strQuery As String
DIM strMessage AS String = “”
DIM dblStartTime, dblEndTime, dblTimeSpent AS Double
DIM bolContinue AS Boolean = False
DIM oDate AS New Date
self.lblMessage.Text = “Please wait. Checking login…”
strUser = tADUser
strPassword = tADPassword
dim LogonServer as string
LogonServer = ReplaceAll(system.EnvironmentVariable(“LOGONSERVER”), “”, “”)
self.lblMessage.Text = "LogonServer: " + LogonServer
Dim adoConnection, adoCommand,adoRecordset As OleObject
strQuery = “SELECT cn FROM 'LDAP://” + LogonServer + "’ WHERE ObjectClass=’*’ "
strUser = “YOURDOMAINHERE” + TRIM( strUser )
dblStartTime = Microseconds
adoConnection = new OLEOBJECT(“ADODB.Connection”)
adoConnection.Provider = “ADsDSOOBJECT”
adoConnection.Properties(“User ID”) = strUser
adoConnection.Properties(“Password”) = strPassword
adoConnection.Properties(“Encrypt Password”) = false
adoConnection.open (“DS Query”, strUser, strPassword)
dblEndTime = Microseconds
dblTimeSpent = ( dblEndTime - dblStartTime ) / 1000000
strMessage = oDate.LongTime + " " + CSTR( dblTimeSpent ) + " seconds to get the user connection."
adoCommand = New OleObject(“ADODB.Command”)
adoCommand.ActiveConnection = adoConnection
adoCommand.CommandText = strQuery
adoCommand.Properties(“Size Limit”) = 1
adoRecordset = New OLEObject(“ADODB.Recordset”)
dblStartTime = Microseconds
Try
adoRecordset = adoCommand.Execute()
// User managed to login
self.lblMessage.Text = strUser+" managed to login on Active Directory Server: "+ LogonServer
Session.StoreUser( tADUser )
bolContinue = True
Catch ExecuteError As OLEException
// User did not manage to login
DIM oNow AS NEW DATE
DIM cMessage AS String = “Unknown user name or invalid password. Please check your settings and try again. [” + oNow.ShortTime + “]”
session.LogActivity( “ActiveDirectoryLogon”, “Unknown user name or password: " + strUser )
self.lblMessage.Text = cMessage
End Try
dblEndTime = Microseconds
dblTimeSpent = (dblEndTime - dblStartTime ) / 1000000
strMessage = oDate.LongTime + " " + CSTR( dblTimeSpent ) + " seconds to log " + strUser + " on.”
Session.LogActivity( “ActiveDirectoryLogon”, strMessage )
adoConnection.close
adoConnection = Nil
adoCommand = Nil
adoRecordset = Nil
IF bolContinue THEN
DIM strEmployeeEmail AS String = Session.GetEmployeeActive( tADUser )
Session.cUserEmail = strEmployeeEmail
END IF
IF bolContinue THEN
DIM cMessage AS String = oDate.AbbreviatedDate + " " + oDate.LongTime + " " + tADUser + " logged in."
Session.LogActivity( “ActiveDirectoryLogon”, cMessage )
MainMenu.Show()
END
exception err as oleexception
self.lblMessage.Text = "Error: " + err.Message[/code]