Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Classic ASP running in Integrated Pipeline

Tags:

asp-classic

I'm migrating a classic asp app (I know, lucky me) to a mixed asp.net/asp site, and it seems like I don't have access to the Request.Form collection. Just as a test, I did this:

for each x in Request.Form 
    Response.Write("<br>" & x & " = " & Request.Form(x)) 
next 

I get this:

Request object error 'ASP 0101 : 80004005' Unexpected error [my script], line xx The function returned |.

If I switch the App Pool from Integrated Pipeline to Classic the code works, but running in classic mode is not an option for the .net app. Is there a workaround in my future?

like image 476
user568259 Avatar asked May 06 '11 17:05

user568259


2 Answers

The Unexpected error when accessing Request.Form in classic asp is because a managed code module or handler has touched the request body, and it's not available to native code after that.

See http://www.asp.net/whitepapers/aspnet4/breaking-changes#0.1__Toc256770154

A managed HTTP module reads some part of the entity body. For example, a module reads Request.Form or Request.Params. This causes the entity body of the POST request to be read into managed memory. As a result, the entity body is no longer available to any native code modules that are running in IIS 7 or IIS 7.5 Integrated mode.

If you are in control of the managed module, instead of just letting the pipeline continue to the classic asp handler, use Server.TransferRequest with an extra http header that you can check for next time your module is executed. See this answer https://stackoverflow.com/a/18078054/2837402

like image 111
Colin S Avatar answered Sep 30 '22 17:09

Colin S


The only thing you can do here is to create another application pool for your asp classic pages and create a new app (aka new virtual directory) for them regarding the new app pool.

As you can't share any application or session scope between asp and asp.net this shouldn't be a problem.

like image 33
YvesR Avatar answered Sep 30 '22 16:09

YvesR