Home News Forum Articles
  Welcome back Join CF
You are here You are here: Home | Forum | How to run ASP.NET in PHP on Apache, for free

You are currently viewing our boards as a guest which gives you limited access to view most of the discussions, articles and other free features. By joining our Virgin Media community you will have full access to all discussions, be able to view and post threads, communicate privately with other members (PM), respond to polls, upload your own images/photos, and access many other special features. Registration is fast, simple and absolutely free so please join our community today.


Welcome to Cable Forum
Go Back   Cable Forum > Computers & IT > Internet Discussion
Register FAQ Community Calendar

How to run ASP.NET in PHP on Apache, for free
Reply
 
Thread Tools
Old 19-02-2005, 18:43   #1
Richard M
Inactive
 
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 45
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
Advertisement
Old 19-02-2005, 18:46   #2
Raistlin
Inactive
 
Join Date: Feb 2004
Location: There's no place like 127.0.0.1
Services: Depends on the person and the price they're offering
Posts: 12,384
Raistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered stars
Raistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered starsRaistlin is seeing silvered stars
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
Raistlin is offline   Reply With Quote
Old 19-02-2005, 19:11   #3
Paul
Dr Pepper Addict
Cable Forum Team
 
Paul's Avatar
 
Join Date: Oct 2003
Location: Nottingham
Age: 61
Services: Flextel SIP : Sky Mobile : Sky Q TV : VM BB (1000 Mbps) : Aquiss FTTP (330 Mbps)
Posts: 27,717
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
Paul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered starsPaul is seeing silvered stars
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 ?
__________________

Baby, I was born this way.
Paul is offline   Reply With Quote
Old 19-02-2005, 19:17   #4
Richard M
Inactive
 
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 45
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
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.
Richard M is offline   Reply With Quote
Old 20-02-2005, 00:51   #5
Millay
Inactive
 
Millay's Avatar
 
Join Date: Oct 2003
Location: Portsmouth
Age: 46
Posts: 1,689
Millay has reached the bronze age
Millay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze ageMillay has reached the bronze age
Send a message via MSN to Millay Send a message via Yahoo to Millay
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...
Millay is offline   Reply With Quote
Old 20-02-2005, 01:09   #6
Richard M
Inactive
 
Join Date: Jun 2003
Location: Los Angeles, CA
Age: 45
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
Re: How to run ASP.NET in PHP on Apache, for free

Richard M is offline   Reply With Quote
Old 20-02-2005, 10:28   #7
Gareth
cf.mega poster
 
Gareth's Avatar
 
Join Date: Dec 2003
Age: 49
Posts: 7,099
Gareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny stars
Gareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny starsGareth has a pair of shiny stars
Re: How to run ASP.NET in PHP on Apache, for free

Nice
Gareth is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 10:01.


Server: osmium.zmnt.uk
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.