0

I am trying to download a webpage in C# but it is giving 403 Forbidden Error.

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

Code:

using (System.Net.WebClient wc = new System.Net.WebClient())
{                       
    try
    {                           
        wc.DownloadFile(webURL, filePath);                                                                                                                                                                                
    }
    catch (System.Exception ex)
    {
        // check exception object for the error
    }
}
Oliver Weichhold
  • 10,259
  • 5
  • 45
  • 87
DRG
  • 71
  • 4
  • See https://stackoverflow.com/a/6905471/3390788 – Frank Alvaro Oct 21 '22 at 20:04
  • Does this answer your question? [WebClient 403 Forbidden](https://stackoverflow.com/questions/3272067/webclient-403-forbidden) – Frank Alvaro Oct 21 '22 at 20:09
  • Added User-Agent Other but still no luck. – DRG Oct 21 '22 at 20:11
  • Please edit the post with the new code – Frank Alvaro Oct 21 '22 at 20:13
  • Also, there are *several* answers to that question. You may want to run through them to see if any one of them is appropriate for your situation. – Frank Alvaro Oct 21 '22 at 20:17
  • Tried all the other options given in the post. Getting 403 Forbidden Error. wc.Headers.Add("user-agent", "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:25.0) Gecko/20100101 Firefox/25.0"); – DRG Oct 21 '22 at 20:22
  • Please edit the post with the code you've attempted – Frank Alvaro Oct 21 '22 at 20:28
  • Your Request Originates from an Undeclared Automated Tool To allow for equitable access to all users, SEC reserves the right to limit requests originating from undeclared automated tools. Your request has been identified as part of a network of automated tools outside of the acceptable policy and will be managed until action is taken to declare your traffic. Please declare your traffic by updating your user agent to include company specific information. – DRG Oct 21 '22 at 20:30
  • This is resolved by adding company specific info on User Agent. Thanks! – DRG Oct 21 '22 at 21:04
  • https://www.sec.gov/os/webmaster-faq#code-support – Frank Alvaro Oct 21 '22 at 21:04

1 Answers1

0

Add company specific info on User Agent.

DRG
  • 71
  • 4