.NET HttpModule does not send form variables to PHP file on RewritePath()

Posted by jammus on Stack Overflow See other posts from Stack Overflow or by jammus
Published on 2010-05-19T15:33:42Z Indexed on 2010/05/20 8:10 UTC
Read the original article Hit count: 206

Filed under:
|
|
|
|

Hello friends.

We have an application running on IIS 6 which uses a custom HttpModule to rewrite urls. This works great (well done us) except in the case where the Context.RewritePath destination is a .php file. The php file is executed as expected, however the $_POST collection is empty meaning it cannot access any forms which are submitted to rewritten urls. The problem does not exist when rewriting to .aspx files as the Request.Form collection is fine.

My question therefore has two parts: Why is the $_POST collection not being populated? Is there a way to ensure that the .php $_POST collection is correctly populated after a rewrite?

I don't have much to show in the way of code. There's just a simple:

context.RewritePath(newPath);

once the HttpModule has figured out where to send the request.

Edit: Interestingly, if I do var_dump(file_get_contents('php://input')); in the PHP file (method described here) the contents of the form is displayed. So the data is reaching the PHP script but not the $_POST array.

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about iis