Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   Internet Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=25)
-   -   How to run ASP.NET in PHP on Apache, for free (https://www.cableforum.uk/board/showthread.php?t=24400)

Richard M 19-02-2005 19:43

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? :cool:
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

Raistlin 19-02-2005 19:46

Re: How to run ASP.NET in PHP on Apache, for free
 
I can honestly say I didn't understand a word of that, it all sounds good though :tu:

Paul 19-02-2005 20:11

Re: How to run ASP.NET in PHP on Apache, for free
 
Interesting - but wouldn't you normally run the systems the other way round - apache on port 80 and the local IIS on some other port ? Also, if the aspx (or asp) file has includes itself, or calls other files, does it all still work ?

Richard M 19-02-2005 20:17

Re: How to run ASP.NET in PHP on Apache, for free
 
Quote:

Originally Posted by Paul M
Interesting - but wouldn't you normally run the systems the other way round - apache on port 80 and the local IIS on some other port ? Also, if the aspx (or asp) file has includes itself or calls other files, does it all still work ?

Yes, and yes.
I'm running Apache on 8080 and IIS on 80 on my setup, they can be whatever you want though.
I came up with this idea today because I wanted to run some ASP.NET within a PHP page and then I thought of this solution.
AFAIK, a page cannot be parsed twice (once by ASP.NET and once by PHP) on the same webserver.

In practice it means that you can have some system on your network which displays a report web page in C#, VB or Perl and then include this on your public webserver which is running PHP.

You could even reverse this and have ASP.NET running on IIS as a public server and then do server-side includes to include a PHP page running on Apache behind the firewall.
There's hardly any point to that though because PHP can run on IIS anyway.

With some fancy kind of Apache rewrite rules and stuff, you could make the server request any page with an .aspx extension from IIS directly.

Millay 20-02-2005 01:51

Re: How to run ASP.NET in PHP on Apache, for free
 
thats pretty cool, opens up some pretty interesting ideas.. yay for lateral thinking...

Richard M 20-02-2005 02:09

Re: How to run ASP.NET in PHP on Apache, for free
 
:cool:

Gareth 20-02-2005 11:28

Re: How to run ASP.NET in PHP on Apache, for free
 
Nice :tu:


All times are GMT +1. The time now is 22:13.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum