Tilde for relative path

  • Thread starter Thread starter SStory
  • Start date Start date
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
 
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
 
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
 
Back
Top