Tips and Tricks

Quick Tip: Checking for Success in Web Calls

No matter how many HTTP codes there are, you really only need to check one property to determine success or failure.

The problem with making HTTP calls is that there are so many return codes that count as successful -- anything from 200 to 399 is probably OK, for example.

If you're an ASP.NET developer and working with either HttpResponse or HttpResponseMessage objects, you need only check the object's StatusCode property: If the property is set to HttpResponse.IsSuccessCode, then everything worked out.

About the Author

Peter Vogel is a system architect and principal in PH&V Information Services. PH&V provides full-stack consulting from UX design through object modeling to database design. Peter tweets about his VSM columns with the hashtag #vogelarticles. His blog posts on user experience design can be found at

comments powered by Disqus
Upcoming Events

.NET Insight

Sign up for our newsletter.

I agree to this site's Privacy Policy.