doubt related withCopy files from network folder to local folder

Posted by Amritha444 under C# on 3/29/2013 | Points: 10 | Views : 1032 | Status : [Member] | Replies : 0
Hi all

I have a emploee photos in a network folder .I want to copy all files from this network folder to local machine folder.Can Anybody paste code for that or check my code and mention whats the problem with that code and how to change
UserImpersonation impersonator = new UserImpersonation();
impersonator.impersonateUser("username", "", "password"); //No Domain is required

List<FileInfo> OcDialerlfinfo = null;
OcDialerlfinfo = GetFileList("*", "\\\\\\hrmsfiles\\Photo");

foreach (FileInfo fileName in OcDialerlfinfo)
string targetFolder = "D:/Share/photo1";
string fileName1 = fileName.ToString();
string destFile1 = fileName.DirectoryName+"\\" +fileName1;

FileInfo fi = new FileInfo(destFile1);
fi.CopyTo(System.IO.Path.Combine(targetFolder, fi.Name), true);
error happening as "Logon failure: unknown user name or bad password." .Iam getting files from network folder but cant copy to local.error arising in last line.What's the problem?
Thanks in Advance


(No response found.)

Login to post response