gpt4 book ai didi

c# - 远程服务器返回错误 : (416) Requested Range Not Satisfiable in C#

转载 作者:行者123 更新时间:2023-11-30 16:51:58 24 4
gpt4 key购买 nike

我试过的代码:

string contents = string.Empty;

using (var wc = new System.Net.WebClient())
{
contents = wc.DownloadString("http://www.bizjournals.com/albany/blog/health-care/2015/10/what-this-local-bank-did-to-control-health-care.html");
}

但是它的抛出错误

The remote server returned an error: (416) Requested Range Not Satisfiable

最佳答案

如果您的客户端未发送 User-Agent header ,某些网络服务器似乎可能会返回 416。尝试像这样添加 header :

wc.Headers.Add("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705");

关于c# - 远程服务器返回错误 : (416) Requested Range Not Satisfiable in C#,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33237558/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com