By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,333 Members | 1,843 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,333 IT Pros & Developers. It's quick & easy.

cant get #include to work in .asp file.

P: n/a
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>
------------------
Thanks for your assistance
Regards
Greg
Jul 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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

"Greg" <el**********@bigpond.com> wrote in message
news:21*****************************@phx.gbl...
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>
------------------
Thanks for your assistance
Regards
Greg

Jul 19 '05 #2

P: n/a
Remember that the include file is literally pulled out and plunked in your
page. So you won't need all those html tags.
"Greg" <el**********@bigpond.com> wrote in message
news:21*****************************@phx.gbl...
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>
------------------
Thanks for your assistance
Regards
Greg

Jul 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.