サーバーの 1 つにファイルを送信しようとしていますが、「ネットワーク パスが見つかりません」というエラーが表示され続けます。以下は、ファイルを送信するために使用しているコードです
try
{
Console.WriteLine("Uploading file to server....Please wait!!");
WebClient client = new WebClient();
NetworkCredential nc = new NetworkCredential(userName, password, "domain");
Uri address = new Uri(@"\\126.00.00.01\MyFolder\test.txt");
client.Credentials = nc;
string fullpath = Path.Combine(Directory.GetCurrentDirectory(), filePath);
byte[] arrReturn = client.UploadFile(address, fullpath);
Console.WriteLine("File uploaded sucessfully");
System.Threading.Thread.Sleep(2000);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
System.Threading.Thread.Sleep(5000);
}
私が間違っていることをしてください。テストすると、サーバーはWindowsエクスプローラーで動作するようです。