Difference between "MapHttpRoute" and "MapRoute"? Difference between "MapHttpRoute" and "MapRoute"? asp.net asp.net

Difference between "MapHttpRoute" and "MapRoute"?


If you use Web API on top of ASP.NET they would ultimately both operate on the same underlying ASP.NET route table - however as correctly pointed out, from the user perspective you call two different methods to register route.

Routing was designed like this so that when hosting outside of ASP.NET, Web API wouldn't have to rely on System.Web.

Bear in mind that Web API is not sitting on top of MVC, Web Forms, or, for that matter ASP.NET at all. It can be hosted within web context (ASP.NET) but can also be self hosted (Console, WPF etc) or even hosted in memory (without port use, useful for i.e. lightweight end-to-end testing).


MapRoute is meant for "normal" ASP.NET MVC controllers whereas MapHttpRoute is meant for Web API controllers.