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);
}
我嘗試將文件發送到與LAN連接的計算機。但我試試這個代碼與不同版本的域名,我System.Net.Sockets.SocketException在使用webclient時
「System.Net.Sockets.SocketException沒有因爲目標 機的連接被拒絕」每次
錯誤。你建議我什麼?
如何使用System.IO讀取httpPath? bool cntrl = System.IO.File.Exists(uploadPath + this.FuplVideo.FileName)?如果它的netqork使用UNC:\\ 10.126.64.230 \ home \ pi \ Videos \ –
我將在我修復此錯誤後將其刪除。 –