3 ms·
There are ways in the .NET framework to read an entire file with one line: File.ReadAllText("file.txt"). And the System.Net.WebClient class provides ways to mak
by eel 14y ago
There are ways in the .NET framework to read an entire file with one line: File.ReadAllText("file.txt"). And the System.Net.WebClient class provides ways to make simple HTTP calls in much fewer lines than WebRequest does.
Likewise, Python has ways for interacting directly with streams.
- emn13 14y agoWebClient's API is essentially buggy; it cannot support encoding properly since the order of operations of the API is different from in HTTP, and further the response headers aren't properly exposed to let you work around the limitation. It's fine for a quick hack, it's useless for a reliable web client.