I'm trying to download a pdf file from https website, but it doesn't work. I'm new to C#, so did some research and found a simple code. Worse, the exception I get is quite generic. Help please.
static void Main(string[] args)
{
string file_ = "https://www.nseindia.com/content/circulars/CMPT34469.pdf";
string path_ = @"E:\RSR\Office\EEP\FileDownloader\output\Hello_World.pdf";
WebClient wc_ = new WebClient();
wc_.DownloadFile(file_, path_);
}
The exception: An unhandled exception of type 'System.Net.WebException' occurred in System.dll Additional information: The remote server returned an error: (403) Forbidden.