FancyPrairie
Programmer
I know you can't reference a dll in vbscript. But searching the internet I found references where you can write some code that includes the dll definition and then save the code as an ocx. (Or something like that.) Then I could reference the ocx via CreateObject. However, I've not found where anyone has done it.
Basically, I want to call the function Logonuser found in the dll advapi32.dll. I created a web page (via asp.net 2.0) that prompts the user for name, password, and domain. It then calls the function Logonuser to authenticate the user. This works fine except, asp is causing other problems. It would be much easier if I could just call LogonUser via a vbscript. Does anyone know how I might do this?
Here's the code I have for the asp.net 2.0 form.
Basically, I want to call the function Logonuser found in the dll advapi32.dll. I created a web page (via asp.net 2.0) that prompts the user for name, password, and domain. It then calls the function Logonuser to authenticate the user. This works fine except, asp is causing other problems. It would be much easier if I could just call LogonUser via a vbscript. Does anyone know how I might do this?
Here's the code I have for the asp.net 2.0 form.
Code:
Private Declare Auto Function LogonUser Lib "advapi32.dll" (ByVal api_strUsername As String, _
ByVal api_strDomain As String, _
ByVal api_strPassword As String, _
ByVal api_intLogonType As Integer, _
ByVal api_intLogonProvider As Integer, _
ByRef phToken As IntPtr) As Boolean
'****************************************************************************
'* ValidateLogon *
'****************************************************************************
Private Function ValidateLogOn(ByVal strUsername As String, _
ByVal strPassword As String, _
ByVal strDomain As String) As Boolean
Dim token As IntPtr 'Token returned by the API call
intLoginCount += 1
If LogonUser(strUsername, strDomain, strPassword, 3, 0, token) = True Then
Return True
Else
Return False
If (intLoginCount > 3) Then Call cmdCancel_Click()
End If
End Function