Skip to content

HttpClient Verses WebClient with .Net and C#

Updated: at 02:12 PM

I often find I do what I know over and over again and don’t look for new solutions if the old tried and true solution works.  At my last hackathon, I wrote an app the screen scraped the starbucks site.  I noticed when I looked at the site that a redirect happened after sign in.  My WebClient call did not follow the redirect.  I asked for help from a very bright Microsoft Azure guy (Josh Twist) who blogs at http://www.thejoyofcode.com/About_us.aspx.  Josh suggested switching to HttpClient and making sure to set the option that follows redirects.

Perfect!  I’m hooked on HttpClient now forever. WebClient is now just in my rear view mirror.

Check out the ORM (Object Relational Mapper) PRISMA. The database access method I use in all my projects