View Single Post
Old 19-02-2005, 19:43   #1
Richard M
Inactive
 
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 46
Posts: 6,343
Richard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze array
Richard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze arrayRichard M has a bronze array
How to run ASP.NET in PHP on Apache, for free

It's so dead simple it's silly.
If for any reason you don't want IIS exposed or you just prefer to use Apache as the public web server, you can still use ASP.NET within your PHP or Perl pages!

All you need are:
IIS 5 or 6 with .NET installed
Apache with PHP or Perl

Apache should be running on your public port and IIS can be running on whatever you like.

Then, all you need to do is this:
PHP Code:
<?php include 'http://localhost:80/test.aspx'?>
In my case I'm running Apache on port 8080 and IIS on port 80 (80 is blocked at my firewall)

Contents of test.aspx:
Code:
<script language="VB" runat=server>
    Sub DoSomething()
        Response.Write ("ASP.NET via PHP is working!")
    End Sub

</script>

<%
    DoSomething()
%>
What's happening here is that PHP is including the test.aspx file but is requesting it over http to "localhost" (this can be any server on the LAN or internet, not just the same one).
IIS is parsing the file through ASP.NET and passing it to Apache which then outputs the contents.

So basically, you've got Apache running as a simple proxy with the advantage of using literally any language that you want.
Want Perl, PHP and C# on the same page?
You could pass arguments to IIS in the URL also if you wanted to.

Here's my test page:
http://richard.phpfuture.net:8080/co...nts/aspnet.php
Richard M is offline   Reply With Quote