Chris Love has a good post
about error handling in ASP.NET. There's a lot of debate (and perhaps confusion) about properly implementing error handling and URL rewriting (see this post
) but Chris has some good insight on this.
The bottom line, in my opinion, is that the behavior is an architectural decision. The status code and page returned may be variable based on the circumstance -- was there truly an unhandled exception? What about when a product ID no longer exists? Should we redirect to closely matching products, assuming we retain information on what the old product was?
There's no single correct answer, but the beauty is that authoring HttpHandlers and HttpModules is so easy in .NET, you can customize the behavior to whatever you need (and even easier in IIS 7). Chris will be talking about HttpHandlers and HttpModules at the Richmond Code Camp