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 Classic
managed pipeline mode, the form values are available to the receiving page. When running in Integrated
mode, the form values are not available to the page.
How do I maintain the form collection while in integrated mode when posting to a URL that uses a default document?
When posting directly to '/index.aspx' there is only 1 request and the form values are retained.
When posting to '/', there are 2 requests. One that I believe is being handled by the DefaultDocumentModule
, and the second is handled by the page class (ASP.index_aspx).
There is a different handler/module that is handling the second request in integrated mode, that I'm unable to identify.
I'm attempting to identify it during the Application_EndRequest
event:
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;
}
Results:
POST '/'
Classic mode EndRequest 1
handler: ASP.index_aspx (System.Web.UI.page)
fieldCount: 5Classic mode EndRequest 2
handler: System.Web.DefaultHttpHandler
fieldCount: 5
Form collection is available to page.
Integration mode EndRequest 1
handler: ASP.index_aspx (System.Web.UI.page)
fieldCount: 0Integration mode EndRequest 2
handler: null
fieldCount: 5
Form collection is NOT available to page.
Which native module/handler is handling the second request?
**Update: **
I found the answer 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 FormControlAdapter
solution given there is working well.
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 ExtensionlessUrlHandler-Integrated-4.0
but could not verify. Using the Application_EndRequest
event, did not give me information on the module, and Advanced Logging doesn't provide information on the Module pipeline either.