Relative Links

patrick24601

Freshman
Joined
May 16, 2005
Messages
34
Does anybody have a clean way to manage relative links in an application that has various levels of directories?

I'd like to ....

1. Keep all of the my images in applicationroot/images and be able to get to them easily no matter how deep I am in the application (deep meaning directory level).

2. Keep my application code in different applicationroot/modules/modulename directories and be able to navigate easily between them.
 
Thanks for the response... albeit short ;)

That does not work for example if I am on page directory/herethere.aspx and it has a link to /directory/herethere.aspx. What you get is the application trying to go to /directory/directory/herethere.aspx. The "/" is usually relative to the directory the current page is in if I am not mistaken.

One of the things I am testing right now is "~/directory/herethere.aspx"
 
"/" takes you up to the web site or virtual directory root.

so if you are in "directory/page.aspx" and you link to yourself, then your link should be "page.aspx" or "/directory/page.aspx"
 
I had the same problem and wound up using "../" to move up a level. In your case I believe it should be "../herethere.aspx"
 
use: "~/applicationroot/images/etc.jpg"

The '~' takes you to root application regardless of the name.
 
Back
Top