Get host/domain name


Ad

Advertisements

K

Karl

There are a number of ways to get this,

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

is a good one...

Karl
 
A

Arjen

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

Is there not a complete function for this?

Thanks again,
Arjen
 
A

Arjen

I found now also this one:
request.ServerVariables("SERVER_NAME")

Is this one not better?

Thanks
 
K

Karl

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
 
Ad

Advertisements

Joined
Nov 10, 2008
Messages
1
Reaction score
0
SchemeDelimiter

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

Is there not a complete function for this?

This is a static (C#)/shared (VB) member of the Uri class.

Use:
Request.Url.Scheme & Uri.SchemeDelimiter & Request.Url.Host

for any new readers of this post.

Dave Jellison
 
Ad

Advertisements


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