string URI = "http://202.200.86.89/testSite/";
openFileDialog1.Title = "选择你要发送的文件";
if(openFileDialog1.ShowDialog() == DialogResult.OK)
textBox1.Text = openFileDialog1.FileName.Substring(openFileDialog1.FileName);
statusBar1.Text = "文件上传中.......";
try
{
System.Net.WebClient myWebClient = new System.Net.WebClient();
myWebClient.UploadFile(URI,"post",this.textBox1.Text);
}
catch(WebException webex)
{
MessageBox.Show("WebError:"+webex.Message);
}
catch(System.Security.SecurityException sex)
{
MessageBox.Show("security Error"+sex.Message);
}
catch(Exception ex)
{
MessageBox.Show("Error:"+ex.Message);
}捕获第三个异常:远程服务器返回错误(501)未实现
openFileDialog1.Title = "选择你要发送的文件";
if(openFileDialog1.ShowDialog() == DialogResult.OK)
textBox1.Text = openFileDialog1.FileName.Substring(openFileDialog1.FileName);
statusBar1.Text = "文件上传中.......";
try
{
System.Net.WebClient myWebClient = new System.Net.WebClient();
myWebClient.UploadFile(URI,"post",this.textBox1.Text);
}
catch(WebException webex)
{
MessageBox.Show("WebError:"+webex.Message);
}
catch(System.Security.SecurityException sex)
{
MessageBox.Show("security Error"+sex.Message);
}
catch(Exception ex)
{
MessageBox.Show("Error:"+ex.Message);
}捕获第三个异常:远程服务器返回错误(501)未实现
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货