Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# FTP
I have a task to be done transfer of files from one machine to other machine using C#.So I have seen many links and articles to transfer files from one machine to other machine.I want to know if we want to transfer files do we need to have the Windows Identity ? or any login credentials .
 
My Code
 
if (!Directory.Exists(destinationFolder))
        Directory.CreateDirectory(destinationFolder + "\\" + DateTime.Now.ToString("ddMMyyyy"));
    string[] files = Directory.GetFiles(sourceFolder);
    foreach (string file in files)
    {
        string name = Path.GetFileName(file);
        string dest = Path.Combine(destinationFolder, name );
        File.Copy(file, dest);
    }
    string[] folders = Directory.GetDirectories(sourceFolder);
    foreach (string folder in folders)
    {
        string name = Path.GetFileName(folder);
        string dest = Path.Combine(destinationFolder, name);
        CopyFolder(folder, dest);
    }
Can any one tell me the pros and cons of transfer of files using C# over LAN?
 
When I am copying the files it is saying "Logon failure: unknown user name or bad password."
 
How can we handle this login to the windows account?
Posted 29-Mar-13 2:51am
Comments
pradiprenushe at 29-Mar-13 8:19am
   
Try this link
http://stackoverflow.com/questions/7445508/moving-file-to-another-computer
http://stackoverflow.com/questions/1432213/copy-file-on-a-network-shared-drive
hemantwithu at 1-Apr-13 1:42am
   
If we have a folder in the network shared path so How can we transfer the file with login credentials ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 319
1 Kornfeld Eliyahu Peter 265
2 Maciej Los 249
3 BillWoodruff 205
4 Sergey Alexandrovich Kryukov 175
0 OriginalGriff 5,107
1 DamithSL 4,157
2 Maciej Los 3,595
3 Kornfeld Eliyahu Peter 3,450
4 Sergey Alexandrovich Kryukov 2,741


Advertise | Privacy | Mobile
Web01 | 2.8.141216.1 | Last Updated 29 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100