In the progression of web application developers, there is a phase during which the developer has the power to build something really useful but lacks the ability to create useful URLs. This phase is dangerous because if the application becomes widely deployed, you're likely to be stuck with a namespace that complements its lack of expressibility with an overabundance of complexity.

That aside, there is one thing constant in the ever-changing world of the web: root. For any domain, the document root unifies and binds all other resources on that domain. If you're ever feeling lost, that's where you want to head. Aaron, digging through a "legacy enterprise application, written in old-school VB6 ASP" found just the function for finding your way from any page to that place of calm.

'finds the root level. good for use on pages than may
'span multiple directories, such as 404 and 500 error
'pages.
function RootLevel()
dim iLoop
dim iCount
dim sTemp
dim sURL

iCount = 0
sURL = Request.ServerVariables("URL")

for iLoop = 1 to len(sURL)
sTemp = mid(sURL, iLoop, 1)
if inStr(1, sTemp, "/") <> 0 then
iCount = iCount + 1
end if
    next

'select case Application("MODE")
  'case "PROD", "STAGE"

for iLoop = 1 to iCount
  RootLevel = RootLevel & "../"
  next

'case "DEV", "TEST"
'for iLoop = 1 to iCount - 2
  'RootLevel = RootLevel & "../"
'next
'end select
end function

This function found itself (most often) as the prefix for other URLs. For instance

link = "<a href=" & RootLevel() & "/foo/bar.asp>bar</a>"

For your moment of Zen, think about what could go wrong here.