我运行帮助“DownloadFile”里的示例,下载的文件也是空的。截图中的浏览器在手机上都能正常打开,里面是有内容的
try
Dim s As String = "http://114.55.92.178:7029/wbs/profile/helloworld.txt"
Dim request = System.Net.WebRequest.Create(s)
request.Method = "Head"
Dim response = request.GetResponse()
response.Close()
output.Show("文件存在:" & response.StatusCode)
Dim htc As new HttpClient(s)
htc.GetInformation()
htc.Close() '必须执行Close方法关闭连接
OutPut.Show("更新日期:" & htc.LastModified)
OutPut.Show("状态码:" & htc.StatusCode)
OutPut.Show("状态描述:" & htc.StatusDescription)
OutPut.Show("内容类型:" & htc.ResponseContentType)
OutPut.Show("内容长度:" & htc.ResponseContentLength)
Network.DownloadFile(s, "D:\CSDown\helloworld.txt")
Output.Show("下载文件成功")
catch ex As exception
output.show("文件不存在:" & ex.message)
End try

此主题相关图片如下:远程下载文件出错.png

[此贴子已经被作者于2020/10/15 11:08:58编辑过]