Skip to main content

Posts

Showing posts from November, 2013

Bare metal HTTP

This time I’ll show you how to create a simple console app that requests resources over the internet using the lowest level APIs (at least the lowest level available in .NET). The whole point of this post is to prove that there is no magic behind entering a URL in the web browser and get a web page out of that. This little app requests a webpage and prints out the response to the console. If you want, you can extend it to save the content to a local file and then show it up in the web browser or whatever. (Maybe I'll do that in a future post). Here I’m using IP and TCP (Network and Transport protocol respectively) to connect the app to the web site, send a request and get a response. The code is self-descriptive but as usual if you have any doubt feel free to contact me. (For the sake of simplicity, I'm not handling exceptions nor writing single responsibility methods and stuff like that). If you are interested in learn more about http and how the web works, I h