0

I am dynamically creating dot net c# console application on my local system (i'm using - this code sourcePath = @"D:\temp\DirectoryToZip.zip"; destFile="@"\192.8.54.227\Test" ; System.IO.File.Copy(sourceFile, destFile, true)).

C#:
 var sourcePath = @"D:\temp\DirectoryToZip.zip";  
 var  destFile= @"\192.8.54.227\Test" ; 
 System.IO.File.Copy(sourceFile, destFile, true))

I am trying file move, but it cannot working. I am trying multiple links

How to copy file from local system to other system in C# (windows app)? https://www.codeproject.com/Questions/1136426/Copy-file-from-local-pc-to-server-using-Csharp https://www.codeproject.com/Questions/423029/how-to-copy-files-from-Local-to-remote-server-with

etc...

I want to copy this zip file to my remote server system(Static IP IIS server). I use C#

Dharman
  • 30,962
  • 25
  • 85
  • 135
  • 1
    Is `Test` a share on `192.8.54.227`? and you have a typo, destfile should be `var destFile = @"\\192.8.54.227\Test" ; ` (notice the second \ at start) – Rand Random Apr 22 '22 at 10:10
  • why you don't use TCP and networking instead? take a look at [this link](https://learn.microsoft.com/en-us/dotnet/api/system.net.sockets.socket.sendfile?view=net-6.0) – Mamink Apr 22 '22 at 10:13
  • Rand Random - Thanks for your reply - i am tried already this var destFile = @"\\192.8.54.227\Test" . This return exception error - The network path was not found. – MahalingaM SubramaniyaM Apr 24 '22 at 05:29
  • please write "@username", this way the user will get notified about your message, I am only here because my last browser session had this page open, otherwise I wouldn't know you have written this comment so about your error `The network path was not found.` you do realise you have to specify a file and not a folder your file should be copied to? other than that can't really help, the c# works as expected, but your destination isn't accessable, could be as easy as the the server isn't running, the share doesn't have the write access rights and what not – Rand Random Apr 24 '22 at 10:20

0 Answers0