Forum Moderators: open

Message Too Old, No Replies

ASP include function

Can one include pages from other domains?

         

HeyJim

3:01 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



I know enough about php to know how to use a snippet of code to include a page from one domain into part of a page on another domain. However, I don't have asp capabilities so I can't experiment with ASP but I'd love to know the snippet necessary to include the contents of the indicated page into the contents of the page holding the snippet of code.

I was given this to use at one point:
<!--#include virtual=” [otherdomain.com...]
One client told me it worked great. Another told it didn't work and furthermore what I wanted to do with ASP was not possible. Bottom line is that three different people have told me, "You can't do it with asp." That sounds inconceiveable to me but, lacking ASP capabilities, I can't test anything to prove it either way.

What short piece of code can be included in an asp page that will reflect a page from another domain within that page holding the code once it's published?

Kind of as an aside, but very relevant, I had yet another client's webmaster claim that he was able to include a page from Site A into a page on Site B without using ASP or PHP and the source code of the included page was right there to be seen. I wasn't able to find out how he did it. His own content was top, left and bottom of the page with the included information in the center two-thirds. A framed solution didn't sound practical to me but I don't know how else he could have done it. Any help there as an alternative would be appreciated as well. It's essential that the copied information actually appear on the client's domain with updates to the copied page automatically appearing (after refreshing) on the subject page.

Thanks.

john_k

3:17 pm on Jun 3, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



The type of include you have indicated is an SSI (Server Side Include). The include is executed by the web server (IIS) before it is handed off to the scripting engine to execute the code. The included file must be a file located under the root of the website. As far as I know, this is how SSIs are handled by all webservers.

However, there are methods for fetching a remote file and using its results within your ASP. Perhaps if you could post the PHP that you think does this it would help to get an ASP equivelant.

As for including a remote file without any scripting on the server, I believe it can only be done as a frame or iframe.

HeyJim

3:30 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



This is the php code we've been using successfully.
<?
@Include'http://otherdomain.com/test.htm';
?>

An Iframe did cross my mind but the contents of the iframe are not attributed to the domain carrying the iframe (I think) so are less than ideal. But, I may have to resort to that.

macrost

3:36 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



You can use MSXML.XMLHTTP object to fect anypage from any site. If the site in question is doing processing, using this object will return the results of that page. Try and make sure that you are using 3.0 and up.

HeyJim

4:41 pm on Jun 3, 2004 (gmt 0)

10+ Year Member



Thanks, Macrost.
Am I to understand that I can insert the appropriate MSXML.XMLHTTP code into any html page and it will fetch the necessary document? Or, are we talking it must be a .asp or .net page? (I'm doing a little checking in Google but it looks like it's going to take more than a few minutes to discover what MSXML.XMLHTTP is.)

Whatever page it's used in, is there a simple format such as the php one that I can use?

RossWal

12:02 am on Jun 11, 2004 (gmt 0)

10+ Year Member



Just stumbled upon this thread, though it may well be dead. The MSXML object referenced by macrost can be executed from the IIS server, or from w/in javascript on the IE client.

HTH,
Ross

too much information

12:21 am on Jun 11, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use exactly the same code as you originally posted and it works fine. The only trick might be that you need single quotes instead of double especially if your code is being generated dynamically because the double quotes may cause your statement to end too early.

HeyJim

12:23 pm on Jun 11, 2004 (gmt 0)

10+ Year Member



Well, the concept of a MSXML object is completely foreign to me (as in, "Don't have a clue what you're talking about!") so beyond implementation.

The php snippet does work for me, I've just been wondering if there is an asp equivalent in simplicity and effect. Apparently not.