title: How to get query string variables in MVC 4's Request?
body: <p>I'm guffawed here working on my first MVC 4 project with the Web Api variety. </p>
  
  <p>In MVC 3 I could get a query string parameter like such:</p>
  
  <pre><code>var unicornName = Request.Query["unicornName"];
  </code></pre>
  
  <p>But in MVC 4, it looks like the Request went from a <code>HttpRequestBase</code> to a <code>HttpRequestMessage</code> and the Query parameter is no more. So, hmm, okay, how do I get them now. I found a couple examples on the web but they are absurd. </p>
  
  <p><a href="http://wcf.codeplex.com/discussions/287299" rel="noreferrer">This fellow recommends</a> splitting the RequestUri's query string by "&amp;" and finding your param and pair. <a href="http://www.west-wind.com/weblog/" rel="noreferrer">And this example</a> shows calling a <code>GetQueryNameValuePairs</code> method on the new request object which returns a list of key value pairs , then doing some linq to find your key and value. It can't really be this backwards to get something so simple. Please tell me I'm missing something!</p>
  
  <p><strong>Note</strong>: I can understand it's going the way of model binding and I should be bringing in query string parameters via the action's method params, but there are still times when query string variables need to be plucked (easily?) from the Request, such as in a Filter.</p>