View Single Post
Old 02-01-2013, 04:05 AM   PM User | #2
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,172
Thanks: 59
Thanked 3,993 Times in 3,962 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
Why are you surprised?

If you have folders set up as
Code:
    /root
        main.aspx
        /css
            master.css
        /script
            code.js
        /subdir
            another.aspx
Then even by the rules of Windows paths, the way to get to /css from "main.aspx" is via "./css/master.css" where as from "another.aspx" it would be "../css/master.css"

So you either need to specify the correct *relative* path from your "another.aspx" file or you must specify an *absolute* path that is relative to the root of your site.

If your /root directory (or whatever it is named, but corresponding to the above picture) is also your web root directory, then you can always get to "master.css" from *ANY* page by using "/css/master.css". That leading "/" means "start at the root directory".

There are other solutions, especially if you control setting up virtual directories on the server, but that's the meat of it.
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote