Click here to Skip to main content
15,502,574 members

Comments by Member 7979150 (Top 6 by date)

Member 7979150 14-Mar-12 1:21am View    
I need to transfer folder which include multiple files and this folder size may be 30 MB or more.I cannot give url because i need to transfer foldrer on client machine silently and could you please explain me how can i use this url.
Member 7979150 13-Mar-12 3:22am View    
could you please tell me if you any other solution to do like u said using .net. please help me.
Member 7979150 17-Feb-12 1:18am View    
I mean file and printer sharing for microsoft networks(network protocol) unchecked on client m/c then server cannot access client machine it will show error "network path not found". even if i access client m/c through run from server it will show same error which it shows through code. Please give me solution. I will be grateful for this. It's very urgent and iam stuck in this more than 10 days. please .............. help me.
Member 7979150 17-Feb-12 1:14am View    
Thanks for reply.
if file and printer sharing for microsoft network(network protocol) is unchecked then in that case i cannot access client machine otherwise it is accessible.
please find my code below:-

public void CreateDir(string DriverPath)
{
IntPtr token = IntPtr.Zero;

WindowsImpersonationContext impersonatedUser = null;
Hashtable Fod_Files = new Hashtable();

try
{
// Create a token for DomainName\UserName

//Call LogonUser function to obtain an access token
// for the specified user

client_Uname = "a1093557";
// client_IPAddress = "india.airtel.itm";
client_pwd = "sairam@9";
DomainName = "india.airtel.itm";


bool result = LogonUser(client_Uname, DomainName,
client_pwd,
LogonSessionType.NewCredentials,
LogonProvider.Default,
out token);

if (result)
{
//create a new window identity from the window access token

WindowsIdentity id = new WindowsIdentity(token);

// Begin impersonation

impersonatedUser = id.Impersonate();

Drv_FolderPath = @"C:\PrntDriver1";
DriverPath = @"\\10.14.65.85\C$\hp";

if (Directory.Exists(Drv_FolderPath))
{
//DeleteDir();
}

// Drv_FolderPath = @"\\" + client_IPAddress + @"\C$\PrntDriver";




System.IO.Directory.CreateDirectory(Drv_FolderPath);

Fod_Files = Chk_Files(DriverPath);

string[] FileName = null;



string[] Drv_Fold = null;






Drv_Fold = DriverPath.Split('\\');
int i = Drv_Fold.Length;
//loop on hashtable which contains all the file with their path
foreach (string f in Fod_Files.Values)
{
FileName = f.Split('\\');

string Dest_Path = Drv_FolderPath + @"\" + FileName[i];

if (!File.Exists(Dest_Path))
{
//it will copy files on client machine
System.IO.File.Copy(f, Dest_Path);
}

}

// utl.putLogData(DateTime.Now.ToString() + " Driver setup copied successfully ");
}

else
{
// if the LogonUser return code is zero,an error has occured

// utl.putLogData("</p>LogonUser failed: " +
// Marshal.GetLastWin32Error().ToString());
//Response.Write("</p>LogonUser failed: " +
//Marshal.GetLastWin32Error().ToString());
}



}
catch (Exception ex)
{


}


finally
{
// Stop impersonation and revert to the process identity
if (impersonatedUser != null)
impersonatedUser.Undo();
//// Free the token
if (token != IntPtr.Zero)
CloseHandle(token);
}

}
Member 7979150 16-Feb-12 7:23am View    
Thank you so much for reply.
I have permissions to create folder on client machine because i have domain id who have administrator rights on domain. using that id i can do anything on those client machine which are on domain. That's why above mentioned code run successfully if i manually checked the protocol "file and printer sharing for microsoft networks"(network protocol). But when i uncheck this checkbox then it will give me error "network path not found" because i cannot even access that machine by typing its ip address in run command.you tell me i need to go through network protocols could you please tell me how can i do this. If you provide me code for this then it's really a great help for me.