Document relative paths and controls?

  • Thread starter Thread starter tsteinke
  • Start date Start date
T

tsteinke

Okay so I had some aspx pages with document relative links to images
and webusercontrols (which also have doc relative pats to images)

I wanted to use forms authentication on, so I was forced to move the
pages to a sub directory, which in turn broke all my links. Ok well I
could go over the 100 or so links by hand and change them to ../images/
instead of images/ and prefix all my usercontrols with ../ but there is
still trouble. Because when the usercontrols themself load the images
that they contain, they those links becom invalid, but sometimes these
controls are on pages in the root, so I can't really change them.

Is there something I am missing here? It would be realy cool if there
was a some way to tell all the pages to run from the root.

I know about the base tag but I don't understand why you can't use a
relative path I really want <Base href="../">

I thought about making all the paths root relative but I develop on my
local machine and copy up to the server so localhost/mysite/images
turns into
remotesite/images

Whats the right way to do this?
 
Hi,

Try:

~/images/

This should allow you to access the images folder from any other pages no
matter where they are within your folder structure.
 
I have always used the "/Images" format. That way, if you move the
page(s) the links will continue to link from the site root, no matter
what. This works great for user controls with embedded anchor tags,
etc...You could then use the controls at any level in the site, but the
links would all remain valid.

JP>
 
Back
Top