title: Cleaning Up Query Strings
body: <p>This is more of an open question. What is your opinion on query strings in a URL? While creating sites in ASP.NET MVC you spend a lot of time thinking about and crafting clean URLs only for them to be shattered the first time you have to use query strings, especially on a search form.</p>
  
  <p>For example I recently did a fairly simple search form with half a dozen text field and two or three lists of checkboxes and selects. This produced the query string below when submitted</p>
  
  <pre><code>countrylcid=2057&amp;State=England&amp;StateId=46&amp;Where=&amp;DateFrom=&amp;DateTo=&amp;Tags=&amp;Keywords=&amp;Types
  =1&amp;Types=0&amp;Types=2&amp;Types=3&amp;Types=4&amp;Types=5&amp;Costs=0.0-9.99&amp;Costs=10.00-29.99&amp;Costs=30.00-59.99&amp;Costs=60.00-10000.00
  </code></pre>
  
  <p>Beautiful I think you'll agree. Half the fields had no information in them and the list inputs are very verbose indeed.</p>
  
  <p>A while ago I implemented a simple solution to this for paging which produced a url such as</p>
  
  <pre><code>www.yourdomain.com/browse/filter-on/page-1/perpage-50/
  </code></pre>
  
  <p>This used a catchall route to grab what is essentially a replacement query string after the filter-on portion. Works quite well but breaks down when doing form submissions.</p>
  
  <p>Id be keen to hear what other solutions people have come up with? There are lots of articles on clean urls but are aimed at asp.net developers creating basic restful urls which MVC has covered. I am half considering diving into model binding to produce a proper solution along those lines. With the above convention the large query string could be rewritten as:</p>
  
  <pre><code>filter-on/countrylcid-2057/state-England/stateId-46/types-{1,0,2,3,4,5}/costs-{0.0-9.99,10.00-29.99,30.00-59.99,60.00-10000.00}/
  </code></pre>
  
  <p>Is this worth the effort?</p>
  
  <p>Thanks,</p>