how to use relative path for external hyperlinks?

Discussion in 'ASP .Net' started by Eric, Jan 25, 2009.

  1. Eric

    Eric Guest

    Hi,

    our webserver is placed into our dmz connected to our local network and to
    internet.
    For accessing some files or directories on the websetver, i use the relative
    path function: Server.MapPath("~/mydir/" & filename)
    This is ok.

    The dns name of our webserver is: dmz05.ourcompagny.nl .
    The local name is: localdmz05 .

    Now, i use this for external hyperlinks:
    http://dmz05.ourcompagny.nl/mydir/link1.aspx , which is ok but i don't want
    to hard-code the dns name, instead i want to also use a relative path for
    external hyperlinks.

    I can't use server.MapPath because its' unknown from internet.

    Thanks for hint
    Eric, Jan 25, 2009
    #1
    1. Advertising

  2. On Jan 25, 12:06 pm, "Eric" <> wrote:
    > Hi,
    >
    > our webserver is placed into our dmz connected to our local network and to
    > internet.
    > For accessing some files or directories on the websetver, i use the relative
    > path function: Server.MapPath("~/mydir/" & filename)
    > This is ok.
    >
    > The dns name of our webserver is: dmz05.ourcompagny.nl .
    > The local name is: localdmz05 .
    >
    > Now, i use this for external hyperlinks:http://dmz05.ourcompagny.nl/mydir/link1.aspx, which is ok but i don't want
    > to hard-code the dns name, instead i want to also use a relative path for
    > external hyperlinks.
    >
    > I can't use server.MapPath because its' unknown from internet.
    >
    > Thanks for hint


    Hi Eric

    you can use Uri class

    Dim myUri As New Uri("http://www.contoso.com/catalog/shownew.htm?
    date=today")
    Dim relativePath As String = myUri.PathAndQuery

    Hope this helps
    Alexey Smirnov, Jan 25, 2009
    #2
    1. Advertising

  3. Eric

    Eric Guest

    thanks

    "Alexey Smirnov" <> schreef in bericht
    news:...
    On Jan 25, 12:06 pm, "Eric" <> wrote:
    > Hi,
    >
    > our webserver is placed into our dmz connected to our local network and to
    > internet.
    > For accessing some files or directories on the websetver, i use the
    > relative
    > path function: Server.MapPath("~/mydir/" & filename)
    > This is ok.
    >
    > The dns name of our webserver is: dmz05.ourcompagny.nl .
    > The local name is: localdmz05 .
    >
    > Now, i use this for external
    > hyperlinks:http://dmz05.ourcompagny.nl/mydir/link1.aspx, which is ok but i
    > don't want
    > to hard-code the dns name, instead i want to also use a relative path for
    > external hyperlinks.
    >
    > I can't use server.MapPath because its' unknown from internet.
    >
    > Thanks for hint


    Hi Eric

    you can use Uri class

    Dim myUri As New Uri("http://www.contoso.com/catalog/shownew.htm?
    date=today")
    Dim relativePath As String = myUri.PathAndQuery

    Hope this helps
    Eric, Jan 26, 2009
    #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. Vlad Koby
    Replies:
    0
    Views:
    352
    Vlad Koby
    Apr 6, 2006
  2. Matt
    Replies:
    3
    Views:
    19,488
    Sudsy
    Jul 8, 2004
  3. Thomas Guettler
    Replies:
    3
    Views:
    737
    Andrei
    Oct 27, 2003
  4. Oren
    Replies:
    1
    Views:
    510
    Michael D. Ober
    Apr 29, 2007
  5. Nigel Wilkinson
    Replies:
    2
    Views:
    374
    Nigel Wilkinson
    Jul 25, 2005
Loading...

Share This Page