title: WebApi 2 Attribute Routing using Http Verb Attributes
body: <p>While having Hands on for the ASP.NET <a href="http://www.asp.net/web-api/overview/web-api-routing-and-actions/attribute-routing-in-web-api-2" rel="nofollow">Web API2 Attribute Routing</a> feature, I observe some strange differences for this feature. </p>
  
  <ol>
  <li><p>To use attribute route we have to use the Route("") attribute and specify the custom routes.</p>
  
  <pre><code>[Route("api/books")]
  public IEnumerable&lt;Book&gt; GetBooks() { ... }
  
  [Route("api/books/{id:int}")]
  public Book GetBook(int id) { ... }
  </code></pre></li>
  <li><p>Also there is change in <code>HttpPost</code>, <code>HttpGet</code>, <code>HttpPut</code> and <code>HttpDelete</code> attributes in WebAPI 2. It introduces additional constructor to specify the Routing using the Attribute. (Example - <a href="https://www.simple-talk.com/dotnet/asp.net/attribute-routing-in-web-api-v2/" rel="nofollow">Simple Talk by Dino</a> and <a href="http://visualstudiomagazine.com/articles/2013/09/17/web-api-routing-attributes-p-1.aspx" rel="nofollow">Visual Studio Magazine article</a>)</p>
  
  <pre><code>[HttpGet("orders/{id:int:range(1, 100)}/show"]
  </code></pre></li>
  </ol>
  
  <p>I installed the Microsoft ASP.NET and Web Tools 2013.1 for Visual Studio 2012 and using the  the Web API2 Empty Project Template created the Sample WebAPI2 application. There If we use the HttpPost Attribute with route as string it gives error, Constructor cannot take attribute.</p>
  
  <p>I also tried the same thing using nuget Package Microsoft.AspNet.WebApi version 5.0.0. Then I downloaded the source code of Article listed in <a href="http://visualstudiomagazine.com/articles/2013/09/17/web-api-routing-attributes-p-1.aspx" rel="nofollow">Visual Studio Magazine Article</a>. But strange thing is there I can see the use of HttpPost attribute which takes input route. There is one difference i noticed that <code>System.Web.Http.HttpPostAttribute</code> is derived from <code>HttpVerbAttribute</code>, where as in my version of <code>System.Web.Http.HttpPostAttribute</code> is derived from <code>Attribute</code> and implements <code>IActionHttpMethodProvider</code> Interface</p>
  
  <p>I went on and downloaded the Asp.NET Mvc source code from <a href="https://aspnetwebstack.codeplex.com/releases/view/101957" rel="nofollow">CodePlex</a>, but strange I did not find the <code>System.Web.Http.HttpPostAttribute</code> implementation with default constructor and single parameter constructor.</p>
  
  <p>Am I missing anything here.</p>