HttpClient Verses WebClient with .Net and C#

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.

About Peter Kellner

Peter is a software professional specializing in mobile and web technologies. He has also been a Microsoft MVP for the past 7 years. To read more about Peter Kellner and his experience click here. For information about how Peter Kellner might be able to help you with your project click here.

Follow me:


Comments

  1. Good tip to keep in mind, thanks Peter!

Trackbacks

  1. […] HttpClient Verses WebClient with .Net and C# – Peter Kellner […]

Your Comments

*

Protected with IP Blacklist CloudIP Blacklist Cloud

Follow

Get every new post delivered to your Inbox

Join other followers: