Clarification in Implementing impersonation

Aug 21, 2008 at 7:40 AM
I am using vb6 as front end and foxpro 6 as back end and working in xp.I have used your comimpersonate,.dll and also it got registered and working fine.But since I stored all the database file in one folder I have set the permission as readonly for users and full rights for admin. After executing the call Auth.impersonate(uname,pwd,domain) when i try to execute the code in user login i am getting error.How to give the permission for that folder thru vb.please find my sample code:

Private Sub cmdOK_Click()
Dim conLogin As New ADODB.Connection
Dim rsLogin As New ADODB.Recordset

dim Auth as Object

 Set Auth = CreateObject("Iuf.Network.Authentication.ComImpersonate")
 Call Auth.Impersonate("username", "pwd", "domain") 

If Trim(txtUserName.Text) = "" Then
    MsgBox "Invalid Employee ID", vbInformation, "Employee ID"
    Exit Sub
ElseIf Trim(txtPassword.Text) = "" Then
    MsgBox "Invalid Password", vbInformation, "Password"
    Exit Sub
End If

conLogin.Open "DSN=Jumbled"

'error while executing the below statement
'[microsoft][ODBC vISUAL FOXPRO DRIVER] File 'login.dbf' does not exist

rsLogin.Open "select * from login where upper(alltrim(empid))='" & UCase(Trim(txtUserName.Text)) & "'", conLogin, adOpenStatic, adLockReadOnly

....... some code

End sub

In admin login it is executed but as a domain user where the permission is set as read only, it is showing the error.
Please help me out


Aug 21, 2008 at 8:49 AM
Actually I have to get the context of the current user identity and replace with the impersonate user (or) programatically use the impersonate user identity to apply for that folder(database folder).I am correct?If this is the case then how to implement that in vb6.(any api function i have to apply) .

Help me.