I am trying to create a folder in remote machine which is in same network and when I ping remote machine I'm getting reply also. but when I try to create folder and try to copy files I'm getting the error
Logon failure: unknown user name or bad password."
Below is the code I m using. Is there any way I can pass user name and password to create folder and copy files into remote machine. Suggest me how this can be achieved.
string path = @"\\30.120.119.121\c$\RemoteFolder";
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
string[] files = Directory.GetFiles(@"C:\Files");
foreach (var item in files)
{
string file = Path.GetFileName(item);
File.Copy(item, path+ file);
}
}