E
E
Eugene2014-01-21 15:44:12
.NET
Eugene, 2014-01-21 15:44:12

Why are files not copied over the network?

Automatically copy a file from a local folder to a network folder. 4 times out of 5 it works.
Code example:

string fs = @"D:\Prog\today.txt";
string ft = @"\\10.50.21.164\TARGET\today.txt";
File.Copy(fs,ft,true);

When it doesn't work, the error "The network path was not found" is thrown, and the network connection is active, it feels like the "ball" is being lost.
How can the issue be resolved?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
G
GavriKos, 2014-01-21
@GavriKos

Google suggested this: social.msdn.microsoft.com/Forums/vstudio/en-US/ffe...
I think that working with a network is somewhat different from working with files within the same machine. Whether at least asynchronously it is necessary to check up there is such a sphere. Trite - ping also can not always pass, and you write something there without checking for the presence of balls.

N
Nikolai Turnaviotov, 2014-01-23
@foxmuldercp

wrap in try/catch, check for availability of balls?

E
Eugene, 2014-01-23
@gloomkolomna

Thanks for the advice.
Made through mssql - without copying to another PC, I immediately send the data to the database.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question