title: read Asp.Net Web api GET values from url
body: <p>I am trying to map <code>/{Controller}/{Variable1}/{Variable2}/{Variable3}</code> to a GET method in controller</p>
  
  <pre><code>public TestController{
  
  public ActionResult Get([FromUrl] Entity instance){}
  
  }
  </code></pre>
  
  <p>So I need to map variables to the entity.</p>
  
  <p>To put it into an example  </p>
  
  <blockquote>
    <p>/Product/{category}/{filter1}/{filter2}/</p>
  </blockquote>
  
  <p>Entity</p>
  
  <pre><code> public class ProductSearchRequest
  { 
         public string Category{get;set;}   
         public string filter1 {get;set;}
         public string filter2 {get;set;}
  }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>public ProductController: Controller {
  public ActionResult GET([FromUri] ProductSearchRequest productSearchRequest){
  
  }
  
  }
  </code></pre>
  
  <p><strong>[EDITED]</strong></p>
  
  <p>Had to do following changes to get this working</p>
  
  <p>Instead of RouteCollection.MapHttpRoute use HttpConfiguration.Routes.MapHttpRoute as this is API routing not MVC routing.</p>
  
  <p>Inherit controller from ApiController rather than Controller which I was before.</p>