how to use relative path for external hyperlinks?

E

Eric

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
 
A

Alexey Smirnov

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
 
E

Eric

thanks

"Alexey Smirnov" <[email protected]> schreef in bericht
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
 

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

Top