从包含257个字符但返回404的URL下载文件 [英] Download a file from a URL which has 257 chars but 404 returned

查看:76
本文介绍了从包含257个字符但返回404的URL下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我是
我尝试使用WebClient从包含257个字符的网址下载文件,但会返回以下错误:

Hello,
I tried to download a file using WebClient from a url which has 257 characters,but the following error is returned:

异常调用"DownloadFile"用"2"表示"2"。参数:"远程服务器返回错误:(404)未找到。"

Exception calling "DownloadFile" with "2" argument(s): "The remote server returned an error: (404) Not Found."

在C:\ Users \ win7 \ downloadfile.ps1:12 char :25

+     $ client.DownloadFile<<<< ($ url,$ path)


At C:\Users\win7\downloadfile.ps1:12 char:25
+     $client.DownloadFile <<<< ($url, $path)

  + CategoryInfo          :NotSpecified:(:) [],MethodInvocationException

    + FullyQualifiedErrorId:DotNetMethodException

 

  + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : DotNetMethodException
 

当我将URL复制到firefox或IE时,我可以下载该文件。然后我尝试从同一个网站下载一个带有Powershell的文件但是其网址很短,我可以用Powershell成功下载它。

When I copy the URL to firefox or IE, I can download that file. then I tried to download a file with Powershell from the same website but whose URL is short, I can download it successfully with Powershell.

之前是否有人发现类似的问题?你能分享一下如何解决它吗?

Does anybody find the similar issue before? Could you pls share how to solve it?

非常感谢。

推荐答案

远程服务器说它找不到文件。它与PowerShell无关。你的链接不好。该链接指向页面而非文件。

Remote server says it cannot find the file. It has nothing to do with PowerShell. You have a bad link. The link is to a page and not a file.


这篇关于从包含257个字符但返回404的URL下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆