I am having trouble getting the logon user function to work. I am attempting to access a share on a network computer. The account I am using is a local account on the manchine - Not a domain account. If I use the logon_new_credentials, the login succeeds but the createdirectory returns bad user/password
IntPtr lnToken;
// LOGON32_LOGON_NEW_CREDENTI
ALS - Using this the logon succeeds but the create directory still returns bad username/ passord
int TResult = LogonUser(@"remotecomputer
\adminuser
", "RemoteComputer", "password", LOGON32_LOGON_INTERACTIVE,
LOGON32_PROVIDER_DEFAULT, out lnToken);
Win32Exception e = new Win32Exception();
string x =e.Message;
if ( TResult > 0 )
{
ImpersonateLoggedOnUser(ln
Token);
using( WindowsIdentity.Impersonat
e(lnToken)
)
{
Directory.CreateDirectory(
"\\\\remot
ecomputer\
\ShareedFo
lder\\Test
");
}
StringBuilder sb = new StringBuilder(80,80);
RevertToSelf();
CloseHandle(lnToken);
}
else
{
}
return;
Start Free Trial