我正在尝试从Dropbox下载ZIP文件,但每次我尝试停止并且只下载~100 kb的文件。它似乎破坏了我从中下载的任何文件,但是如果我尝试使用普通浏览器下载它就可以工作。
Dim remoteUri As String = "https://www.dropbox.com/-/-------/test.zip?dl=0"
Dim fileName As String = "test.zip"
Dim myStringWebResource As String = Nothing
Dim myWebClient As New WebClient()
myStringWebResource = remoteUri + fileName
myWebClient.DownloadFile(myStringWebResource, fileName)
答案 0 :(得分:1)
你的remoteUri错了。您要两次添加文件名。这会给你一个糟糕的网址。
Dim remoteUri As String = "https://www.dropbox.com/-/-------/{0}?dl=1"
Dim fileName As String = "test.zip"
Dim myStringWebResource As String = Nothing
Dim myWebClient As New WebClient()
myStringWebResource = String.Format(remoteUri, fileName)
myWebClient.DownloadFile(myStringWebResource, fileName)
尝试添加dl = 1以强行下载。