Tilde for relative path

Discussion in 'ASP .Net' started by SStory, Oct 16, 2003.

  1. SStory

    SStory Guest

    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
    SStory, Oct 16, 2003
    #1
    1. Advertising

  2. SStory

    Greg Burns Guest

    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


    "SStory" <> wrote in message
    news:Onw$Nb$...
    > 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
    >
    >
    Greg Burns, Oct 16, 2003
    #2
    1. Advertising

  3. SStory

    SStory Guest

    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

    "SStory" <> wrote in message
    news:Onw$Nb$...
    > 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
    >
    >
    SStory, Oct 19, 2003
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PJ6
    Replies:
    10
    Views:
    10,951
  2. Matt
    Replies:
    3
    Views:
    19,501
    Sudsy
    Jul 8, 2004
  3. Thomas Guettler
    Replies:
    3
    Views:
    740
    Andrei
    Oct 27, 2003
  4. Oren
    Replies:
    1
    Views:
    522
    Michael D. Ober
    Apr 29, 2007
  5. Nigel Wilkinson
    Replies:
    2
    Views:
    374
    Nigel Wilkinson
    Jul 25, 2005
Loading...

Share This Page