ASP Help


Active Member
I have a header.asp file located in the root directory of my website. This file contains the title and navigation areas for the site. I call the file from other pages using:

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

I have now added a /news directory that runs .asp pages associated with news application I have installed. I would like to include the header.asp file in these pages as well. However, when I include this file, the links on the navigation bar do not work and the graphics do not show since the loaded file is actually in the /news directory. The links are defined in the header file as follows:

<a href="default.asp">Home</a>

How can I make the header.asp file point to the right locations no matter what directory the calling file is located in?

Start your link url from the root directory.

Change this:
<a href="default.asp">Home</a>

<a href="/default.asp">Home</a>

The / tells the web server to start at the root (html) directory and work its way from there.
When there is no / the web server looks in the same directory the the current file is in.

For example, if you had a file in a directory called news that you wanted a link to you would do something like this.

<a href="/news/default.asp">Todays News</a>