cant get #include to work in .asp file.

G

Greg

I'm new to html and web coding, this is a simple one -
appreciate your help!

I'm attempting to get my browser bar links to reside in a
single .asp file to avoid multiple additions to pages
when I add a page to the site. I've done a lot of
reading and surfing, believe I know how to do it, but
can't get it to work.

I've installed IIS on my machine running XP pro, and have
created two .asp files, one called default.asp, the other
navigation.asp

both pages browse OK separately, but the navigation page
text does not appear within the default page at all (like
it's not getting "called" - here's the cut down code.

<html>
<head>
<title></title>
</head>

<body>
<% %>
<p>
This is the default page (filename default.asp)
<p>
<!- #include file="navigation.asp"->

</body>
</html>

-----------------

<html>
<head>
<title></title>

</head>
<body>
<% %>
This is the browser page (filename navigation.asp)

</body>
</html>
 
R

Ray at

Hi Greg,

Includes are done as:

<!-- #include file="navigation.asp" -->

Notice it's two dashes on either end, not one.

Also, if you are going to use this include for navigation, you may want to
do a virtual include as such:

<!-- #include virtual="/navigation.asp" -->

Doing a virtual include with the leading / will make it so that include is
always looked for from the root of your site. So, whether you have an asp
page in the root of your site, in a subdirectory, or in a directory 15
levels down, it you won't have to change your include directive in any of
them. If you do a file include, you'd wind up with an include like:

<!-- #include file="../../../../../../../../../../../../navigation.asp" -->

if you were a bunch of directories down.

Ray at home
 
T

Tom B

Remember that the include file is literally pulled out and plunked in your
page. So you won't need all those html tags.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,540
Members
45,025
Latest member
KetoRushACVFitness

Latest Threads

Top