You are viewing a plain-jane printable version of http://CoverYourASP.com/BaseHref3.asp.
See how this was done

 

The sURLTest array

I then loop through an array (defined in include/config.asp as we'll see below), searching for strings that will define which server I am running on. When we find a match we add a sub-folder to the path.

Here are the arrays in include/config.asp:

// ============================================
// base href - the URL of your pages
// ============================================
// if a string in sURLTest is found, then the offset is applied from
// sURLOffset. As an example, I want my base hrefs to be
// http://CoverYourASP.com/ on production server and
// http://localhost/cya/ on development server.
var sURLTest = new Array (
   '.com',      // if this found in server name..
   'localhost'
   );

var sURLOffset = new Array (
   '',         // ..apply this offset
   'cya'
   );

As shipped in the download I first look for ".com" in the server name (obviously you should change both of these arrays to fit your circumstances). If a ".com" is found, then I don't need any sub-folder, so I leave the sURLOffset empty. The final base href is therefore "http://CoverYourASP.com/".

If "localhost" is found, then "cya" is added to the server name, and I end up with "http://localhost/cya/". Bingo!