I am trying to build a managed HTTP module that inspects form data before the request gets passed on to the underlying handler (ASP.NET or ASP Classic). Everything works fine when the request is for an ASP.NET page. With ASP Classic pages, however, an unspecified error (80004005) is thrown every time Request.Form is accessed.
I suspect the problem is that the HTTP module reads all of the form data when it accesses Request.Form. Then, when ASP Classic attempts to access the form data, there is nothing left to read.
Is there any way to read form data from a managed HTTP module and still leave it intact and readable by ASP Classic?
Update:
After doing a little bit of research, I attempted the following...
Dim context As HttpContext = HttpContext.Current
Dim provider As IServiceProvider = CType(context, IServiceProvider)
Dim request As HttpWorkerRequest = CType(provider.GetService(GetType(HttpWorkerRequest)), HttpWorkerRequest)
Dim buffer() As Byte = request.GetPreloadedEntityBody()
... operating under the assumption that I should be able to at least access the beginning of the form data. I assumed that the size of the data in GetPreloadedEntityBody would be uploadReadAheadSize (48KB) but this assumption seems to be incorrect as it always return null.
Can anybody shed some light on this?