Document relative paths and controls?

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?
 
G

Guest

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.
 
J

joey.powell

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>
 
T

tsteinke

This only seems to work on server controls and they don't show up in
the designer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top