title: Pass querystring to 404 page
body: <p>I have error handling set up in IIS 7 to forward to a 404 page, but the querystring does not ever appear to be passed over.</p>
  
  <p>For example, this page does not exist so it directs to the 404 page:</p>
  
  <pre><code>www.mysite.com/nonexistingpage.aspx?id=1
  </code></pre>
  
  <p>On the 404 page, in the page_load, I cannot access id=1 because it doesn't seem like it's ever reaching the 404 page. So, trying to get it using these methods doesn't work:</p>
  
  <pre><code>Request.UrlReferrer.PathAndQuery
  Request.ServerVariables["HTTP_REFERER"]
  </code></pre>
  
  <p>In IIS, my Path is entered as: /404.aspx and the Type is set to: Execute URL. How can I ensure the query string will be passed to the 404 page?</p>
  
  <p>Edit: In Fiddler, the redirection is: /404.aspx?aspxerrorpath=/nonexistingpage.aspx, so this confirms it's definitely not being passed over.</p>