使用C#下载网页,给出403 Forbidden Error



我试图用C#下载一个网页,但它给出了403 Forbidden Error。

网址:https://www.sec.gov/Archives/edgar/data/1012968/000175272422189567/0001752724-22-189567.txt

代码:

using (System.Net.WebClient wc = new System.Net.WebClient())
{                       
try
{                           
wc.DownloadFile(webURL, filePath);                                                                                                                                                                                
}
catch (System.Exception ex)
{
// check exception object for the error
}
}

在用户代理上添加公司特定信息。

相关内容

最新更新