HTTP Status and .NET Exceptions

2008-03-23 @ 12:00#

it's a small thing, but still important.

when i'm working with Web code (in C#/ASP.NET) i *always* thrown an HTTPException instead of a generic Exception or even ApplicationException. not only does this simplify things (there is a fixed set of codes and their meaning is well understood), it also improves the usefulness of the application.

one cool thing about getting deep into Web programming with HTTP is that i now understand the value of writing Web code that supports more than just browser clients. i even have written my own HTTPClient class (in exyus) in order to execute HTTP calls against an arbitrary server. with this kind of coding, a consistent set of return codes is *essential.* and that's where HTTPException comes in.

gotta say, the HTTP spec is pretty cool.

code