Thursday, April 28, 2011

Move zip file between servers using C#

I want to move the zip file from one server to another server. What is the best way to do that using C#?

If i am on my local machine running my C# application. And I want to access two servers server A and serverB using File.COpy() to transfer the file from A to B then it is giving me credential issue.

I don't know whether I have UNC share for both the servers. I want to use webrequest to transfer the zip file from Server A to Server B from my machine.

From stackoverflow
  • If you have a UNC share on the destination server, you can just use

    System.IO.File.Copy(String sourceFileLocation, 
                         String destinationFileLocation)
    
    alice7 : How can I check whether my destination server has UNC share or not?
    Paul Ruane : In the Run dialog, type \\servername and see what shares are listed. Command-line equivalent is net view \\servername.
    alice7 : When im trying to use the copy function im getting couldn't find part of the path for source file. But i can use the same path in cmd line to pen the folder.what could be the reason
    alice7 : If i don't have the UNC share on destination server then?
  • Otherwise you have to simply FTP it.

    http://www.devasp.net/net/articles/display/280.html

0 comments:

Post a Comment