Get host/domain name

  • Thread starter Thread starter Arjen
  • Start date Start date
There are a number of ways to get this,

Request.Url.Scheme & Request.Url.SchemeDelimiter & Request.Url.Host

is a good one...

Karl
 
I can't find this one:
Request.Url.SchemeDelimiter

Is there not a complete function for this?

Thanks again,
Arjen
 
I found now also this one:
request.ServerVariables("SERVER_NAME")

Is this one not better?

Thanks
 
Request.ServerVariables("SERVER_NAME")
will return the same thing as Request.Url.Host, but using Request.Url.Host
is prefered.

I'm not sure what you meant that you can't find SchemeDelimiter...here's the
documentation:

http://msdn.microsoft.com/library/d...l/frlrfsystemuriclassschemedelimitertopic.asp

Request.Url is of type Uri.

You can simply use Request.Url.Host if you know it'll always be http:// and
just append http:// infront:
"http://" & Request.Url.Host

or you can use what I gave as an example if you want the entire thing
programmatically.

Karl
 
Back
Top