question on LogonUser

B

bob

Hi

My Project has 2 servers, a Web Server(Windows 2000) and a DB
Sever(Windows 2003).
DB Server has an account called "testAccount"

on Web Server, there is a shared folder named "Test", the
"testAccount" has the full control of the "Test" folder.
i wrote a .exe file to logon to DB Sever to fetch a file with the
account "testAccount".code like this:
*******************************************************
IntPtr tokenHandle = IntPtr.Zero;
WindowsImpersonationContext wic = null;
const int LOGON32_LOGON_NEW_CREDENTIALS = 9;
const int LOGON32_PROVIDER_WINNT50 = 3;

bool returnValue = LogonUser(
"testAccount",
"DB SeverName",
"pwd",
LOGON32_LOGON_NEW_CREDENTIALS,
LOGON32_PROVIDER_WINNT50,
ref tokenHandle);
*******************************************************
when double click the .exe file In Web Server$B!$(B
the LogonUser() returns true, but cannot read file in "Test" folder.
the WindowsIdentity.GetCurrent().Name also returns Web Server's User
Name,not "testAccount"

anyone call help me?
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top