title: IIS 7 - Form post values lost when POSTing to '/' which has a default document (index.aspx)
body: <p>I have a asp.net webform that I'm posting to '/' url without a filename, which is transferred to a default document (index.aspx). When running the app pool (.net v4.0) in <code>Classic</code> managed pipeline mode, the form values are available to the receiving page. When running in <code>Integrated</code> mode, the form values are not available to the page.  </p>
  
  <p><strong>How do I maintain the form collection while in integrated mode when posting to a URL that uses a default document?</strong></p>
  
  <p>When posting directly to '/index.aspx' there is only 1 request and the form values are retained.<br>
  When posting to '/', there are 2 requests. One that I believe is being handled by the <code>DefaultDocumentModule</code>, and the second is handled by the page class (ASP.index_aspx).</p>
  
  <p>There is a different handler/module that is handling the second request in integrated mode, that I'm unable to identify.</p>
  
  <p>I'm attempting to identify it during the <code>Application_EndRequest</code> event:</p>
  
  <pre><code>void Application_EndRequest(object sender, EventArgs e)
  {
      HttpApplication app = ((HttpApplication)sender);
      int fieldCount = Request.Form.Count; // there are 5 fields in my POST
      var handler = app.Context.Handler;
  }
  </code></pre>
  
  <p>Results:</p>
  
  <p>POST '/'</p>
  
  <ul>
  <li><p>Classic mode EndRequest 1<br>
  handler: ASP.index_aspx (System.Web.UI.page)<br>
  fieldCount: 5</p></li>
  <li><p>Classic mode EndRequest 2<br>
  handler: System.Web.DefaultHttpHandler<br>
  fieldCount: 5</p></li>
  </ul>
  
  <p>Form collection <strong>is</strong> available to page.</p>
  
  <ul>
  <li><p>Integration mode EndRequest 1<br>
  handler: ASP.index_aspx (System.Web.UI.page)<br>
  fieldCount: 0</p></li>
  <li><p>Integration mode EndRequest 2<br>
  <strong>handler: null</strong><br>
  fieldCount: 5</p></li>
  </ul>
  
  <p>Form collection <strong>is NOT</strong> available to page.</p>
  
  <p><strong>Which native module/handler is handling the second request?</strong></p>
  
  <p>**Update: **</p>
  
  <p>I found <a href="https://stackoverflow.com/questions/7228344/postback-doesnt-work-with-aspx-page-as-default-document">the answer</a> to why I was losing the form collection. "Event Handlers Might Not Be Not Raised in a Default Document in IIS 7 or IIS 7.5 Integrated Mode". The <code>FormControlAdapter</code> solution given there is working well.</p>
  
  <p>However, I still was not able to identify the module/handler that was handling the request and removing the the posted form collection. I suspected <code>ExtensionlessUrlHandler-Integrated-4.0</code> but could not verify. Using the <code>Application_EndRequest</code> event, did not give me information on the module, and Advanced Logging doesn't provide information on the Module pipeline either.</p>