To download file using web browser i have to use VPN or to be connected to specific WiFi network. So lets presume, that i am connected to that specific WiFI. So the procedure to download file using url is like this:
- I need to open specific website (lets call it www.abc.com/start) in browser (i dont need to enter any credentials just to load and nothing to do).
- Then i can open www.abc.com/prictureA and download it. If i dont open www.abc.com/start and go directly to www.abc.com/prictureA i get info - NOT AUTHENTICATED.
Once i opened in browser www.abc.com/start, i can open www.abc.com/prictureB www.abc.com/prictureC and so on unlimited times (maybe 1 or 2 hours?).
If i use this:
WebClient webClient = new WebClient();
webClient.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.33 Safari/537.36");
Uri remoteFileUrlStart = new Uri("www.abc.com/start");
webClient.DownloadFileAsync(remoteFileUrlStart, "test.jpg");
I get test.jpg saying not authenticated. How to open first www.abc.com/start programatically before downloading www.abc.com/start?