title: Why is this query string invalid?
body: <p>In my asp.net mvc page I create a link that renders as followed:</p>
  
  <p><code>http://localhost:3035/Formula/OverView?colorId=349405&amp;paintCode=744&amp;name=BRILLANT%20SILVER&amp;formulaId=570230</code></p>
  
  <p>According to the W3C validator, this is not correct and it errors after the first ampersand. It complains about the &amp; not being encoded and the entity &amp;p not recognised etc.</p>
  
  <p>AFAIK the &amp; shouldn't be encoded because it is a separator for the key value pair.</p>
  
  <p>For those who care: I send these pars as querystring and not as "/" seperated values because there is no decent way of passing on optional parameters that I know of.</p>
  
  <p>To put all the bits together:</p>
  
  <ul>
  <li>an anchor (&lt;a>) tag's href attribute needs an encoded value</li>
  <li>&amp; encodes to &amp;amp;</li>
  <li>to encode an '&amp;' when it is part of your parameter's value, use %26</li>
  </ul>
  
  <p>Wouldn't encoding the ampersand into &amp; make it part of my parameter's value?
  I need it to seperate the second variable from the first</p>
  
  <p>Indeed, by encoding my href value, I do get rid of the errors. What I'm wondering now however is what to do if for example my colorId would be "123&amp;456", where the ampersand is part of the value.
  Since the separator has to be encoded, what to do with encoded ampersands. Do they need to be encoded twice so to speak?</p>
  
  <p>So to get the url:  </p>
  
  <p><code>www.mySite.com/search?query=123&amp;amp;456&amp;page=1</code></p>
  
  <p>What should my href value be?</p>
  
  <p>Also, I think I'm about the first person in the world to care about this.. go check the www and count the pages that get their query string validated in the W3C validator..</p>