Tilde for relative path

S

SStory

Where all can I use the ~ to represent the root?

I have a dir struct like so

-root
|----images
|
|----dirA
| |---file1.aspx
|----dirB
header.ascx
home.aspx

all pages get a header and footer control that are in the root.
These have images and take them from and images folder off the root. Also
hyperlink controls are used to build a dynamic menu.
When in a subdir like dirA or dir B, I was adding them with refrences like
.../home.aspx (in the header control). This worked fine here but on the host
provider gave a .. (cannot reference past top directory) or something liike
that.)

Should I have used a ~ instead? Don't know why it works here and not
there....

thanks,

Shane
 
G

Greg Burns

I think you can use the tilde only when working with server controls. When
ASP.NET renders the page it will replace it with the proper relative path.

Greg
 
S

SStory

Well, I discovered the following.
If you use an ASCX file that dynamically builds hyperlinks and it is
included on a page in a subfolder, the links cannot be ../something on some
host providers but seem to work for ~/something.

Shane
 

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

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top