In C#.NET, I want to fetch data from an URL and save it to a file in binary.
Using HttpWebRequest/Streamreader to read into a string and saving using StreamWriter works
Minimalist answer:
using (WebClient client = new WebClient()) { client.DownloadFile(url, filePath); }
Or in PowerShell (suggested in an anonymous edit):
[System.Net.WebClient]::WebClient $client = New-Object System.Net.WebClient $client.DownloadFile($URL, $Filename)