Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 25th, 2005, 10:26 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Virtual and relative paths - please explain

Hi,

We're using Win2k3 IIS6. I have a little vb script that I want to include in all files on the website.

This vbscript refers to a series of style sheets. The stylesheets are stored in a directory called 'css' in the root of the site.

In the vbscript I refer to them like this:
Code:
<link href="/css/skins/default.css" rel="stylesheet"...
This seems to work in all pages that I tested, even if the pages are in different directories.

This is great, but I want to be sure it actually works. I thought I would have to refer to the stylesheets like this:
Code:
<link href="../../css/skins/default.css" rel="stylesheet"...
.

That is, including the dots and dashes at the start. I don't seem to have to do this. Is that right?

Is this the difference between virtual and relative paths or something?

cheers

s

 
Old May 26th, 2005, 04:46 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,212
Thanks: 0
Thanked 1 Time in 1 Post
Default

both paths are virtual

this path is absolute because it always refers to the same virtual directory regardless of where the page that contains this line is located:
/css/skins/default.css

this path is relative because you cannot tell where it points to unless you also know where the page that contains this line is located:
../../css/skins/default.css

OK?
Phil
 
Old May 27th, 2005, 01:33 AM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ok, thanks.

Is there anything wrong with using absolute paths? Anything to be aware of?

 
Old June 2nd, 2005, 06:59 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Nothing like that in using absolute paths. If you are error prone, better stick to absolute path. If you are a smart code freak, go with relative. But in the later case if the file is moved to some other folder in the hierarchy, then all the occurances of relative reference need to be looked into and modified. Same is not the case with absolute.

No hard and fast rule to follow any of these, just got to understand how it works and apply the one you are comfortable with.

Cheers

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with App root relative paths chroniclemaster1 ASP.NET 2.0 Basics 4 October 7th, 2008 03:34 AM
paths table FT BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 December 12th, 2006 11:50 AM
Using document() with relative paths boen_robot XSLT 4 June 4th, 2006 05:41 PM
Site root and document relative paths. nicnacs Dreamweaver (all versions) 5 October 5th, 2004 05:35 PM
HELP with relative paths in FileSystemObject stalker Javascript 5 September 4th, 2003 02:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.