Click to See Complete Forum and Search --> : Include Flies


Redhead
10-10-2004, 10:44 AM
Hi There

I'm very very new to asp, and was wondering how you can include a file into a page.

with php it is done:
include ("page.php");

can you do that with asp
include ("http://addressofpage.com")

i want to include a external page. can that be done and how?

Thanks So Much :)

buntine
10-10-2004, 11:24 AM
There is two primary methods. The first, and most common, is via SSI (Server-Side Includes).

<!-- #include file="yourFile.inc" -->

This method will grab the contents of the included file and simply paste it into the calling page. The convention is to give your included files a .inc extension, though, .asp will also work fine.
Note, an SSI call must be done outside of the ASP tags (<% ... %>).

The second method is to use the Server.Execute(file) method.

<%
Server.Execute("file.asp")
%>

This method will treat the included file as a seperate script from the calling page.

Regards.