title: Copying file from Remote server to local and vice versa
body: <p>thanks for ur quick response. but im stucked with login only. im using following code to try to login: </p>
  
  <pre><code>bool success = LogonUser("username", "000.000.000.000", "#####",2 ,0 , out userToken);
  </code></pre>
  
  <p>but im getting exception as failed
  im using username and pwd which i use to login via mstsc. </p>
  
  <p>Im writing code to copy files from remote machine to local machine and vice versa.
  but im not able to know how can i specify credentials to do so..
  my code is following:</p>
  
  <pre><code>string sourceFile = System.IO.Path.Combine(globalInfo.GlobalServerPath, sourcePath ));
  string destFile = System.IO.Path.Combine(globalInfo.GlobalPath, destPath)
  
  
  string[] files = System.IO.Directory.GetFiles(sourceFile);
  
  foreach (string s in files)
    {
     string fileName = System.IO.Path.GetFileName(s);
    fileName = System.IO.Path.Combine(destFile, fileName);
   System.IO.File.Copy(s, fileName, true);
   }
  </code></pre>
  
  <p>here i get error : <strong>Could not logon..</strong> </p>
  
  <p>for line</p>
  
  <p><strong>string[] files = System.IO.Directory.GetFiles(sourceFile);</strong></p>
  
  <p>im connecting to remote machine.</p>
  
  <p>Please help</p>