.NET Blog

Free. Cross-platform. Open source. A developer platform for building all your apps.

ASP.NET Web API: Using Namespaces to Version Web APIs

In this post, I’ll show how to extend the routing logic in ASP.NET Web API, by creating a custom controller selector. Suppose that you want to version your web API by defining URIs like the following: /api/v1/products/ /api/v2/products/ You might try to make this work by creating two different “Products” controllers, and ...

ASP.NET Web API and HTTP Byte Range Support

Range requests is the ability in HTTP to request a part of a document based on one or more ranges. This can be used in scenarios where the client wants to recover from interrupted data transfers as a result of canceled requests or dropped connections. It can also be used in scenarios where a client requests only a subset of a larger ...

Capturing Unhandled Exceptions in ASP.NET Web API’s with ELMAH

I'm a fan of using ELMAH to track unhandled exceptions in my ASP.NET applications. If you haven't tried ELMAH, you should definitely check it out. There's even an ELMAH NuGet package so it's trivial to install. Now that I'm getting my feet wet with Web API, I'd like to have any Web API unhandled exceptions be directed to ELMAH as well so ...

Enabling ASP.NET Web API Help Pages for ASP.NET Web Forms Applications

ASP.NET Web API Help Pages is a new preview feature that automatically generates help page style content for your Web API endpoints. You can read more about it at Introducing the ASP.NET Web API Help Page and in further posts on Yao's blog. I won't revisit the basics of the feature here. Instead, what I want to focus on is bringing this new ...

An ASP.NET Open Source How-To Decoder Ring

As you probably know, ASP.NET MVC, Web API, and Web Pages are available as open source on aspnetwebstack.codeplex.com. If you want to go beyond using the official RTM versions and either use the latest nightly drops, compile it yourself, or create pull requests then here’s a decoder ring for how to get started:1) Using the Nightly NuGet ...

Getting Symbols and Source with ASP.NET Nightly NuGet Packages

You can now get full symbols and source along with the nightly NuGet packages making it possible to debug the latest MVC, Web API, and Web Pages bits by tracing directly through the source. This is enabled by SymbolSource, which hosts the symbols and source for the nightly NuGet packages, and MyGet which hosts the nightly NuGet feed. Great ...

List of ASP.NET Web API and HttpClient Samples

Here is a list of the Web API and HttpClient samples you can find in our samples repository on aspnet.codeplex.com. They illustrate various features of Web API and HttpClient targeting either Visual Studio 2010 using .NET 4 or Visual Studio 2012 using .NET 4.5 with async/await language support. For details on how get up and running with the ...