string uploadPath = "http://10.126.64.230/home/pi/Videos/";
WebClient webclient = new WebClient();
CredentialCache cc = new CredentialCache();
Uri uri = new Uri("http://10.126.64.230/pi");
NetworkCredential nc = new NetworkCredential();
nc.Domain = "root";
nc.UserName = "pi";
nc.Password = "posix";
cc.Add(
uri,
"NTLM",
nc);
webclient.Credentials = cc;
//System.Text.Encoding.ASCII.GetString(responseArray);
bool cntrl = System.IO.File.Exists(uploadPath + this.FuplVideo.FileName);
if (cntrl)
{
// fileName = uploadPath + this.FuplVideo.FileName + DateTime.Now.ToString("yyyy-MM-dd HHmmtt") + ext;
// webclient.UploadFile(uploadPath, "POST", fullFilePath);
}
else
{
webclient.UploadFile(uploadPath, "POST", fullFilePath);
}
I try to send a file to a machine that connected with LAN. But I try this code with different versions of domain, I got
"System.Net.Sockets.SocketException no connection because of target machine refused"
error every time. What do you suggest me?
There is a chance the target machine has a firewall rule on the port you are accessing. I am guessing this is port 80. try to telnet to the remote server and see if you get a connection. if you cant connect, then it must be a firewall issue