I'm trying to send a file to one of our servers but I keeping getting the error "network path not found". Below is the code I'm using to send the file
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);
}
Please what am I doing wrong. The server seems to work on windows explorer when test it.