473,326 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

Get host/domain name

Hello,

How can I get the current host/domain name?

I my website is hosted at this http://www.mydomain.com or
http://mysub.mydomain.com/dir/ then I want to get this:
http://www.mydomain.com or (in sample 2) http://mysub.mydomain.com/

How can I realise that?

Thanks!
Nov 18 '05 #1
4 4346
There are a number of ways to get this,

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

is a good one...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl**********@news2.zwoll1.ov.home.nl...
Hello,

How can I get the current host/domain name?

I my website is hosted at this http://www.mydomain.com or
http://mysub.mydomain.com/dir/ then I want to get this:
http://www.mydomain.com or (in sample 2) http://mysub.mydomain.com/

How can I realise that?

Thanks!

Nov 18 '05 #2
I can't find this one:
Request.Url.SchemeDelimiter

Is there not a complete function for this?

Thanks again,
Arjen
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> schreef in
bericht news:ed**************@TK2MSFTNGP15.phx.gbl...
There are a number of ways to get this,

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

is a good one...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl**********@news2.zwoll1.ov.home.nl...
Hello,

How can I get the current host/domain name?

I my website is hosted at this http://www.mydomain.com or
http://mysub.mydomain.com/dir/ then I want to get this:
http://www.mydomain.com or (in sample 2) http://mysub.mydomain.com/

How can I realise that?

Thanks!


Nov 18 '05 #3
I found now also this one:
request.ServerVariables("SERVER_NAME")

Is this one not better?

Thanks
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> schreef in
bericht news:ed**************@TK2MSFTNGP15.phx.gbl...
There are a number of ways to get this,

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

is a good one...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl**********@news2.zwoll1.ov.home.nl...
Hello,

How can I get the current host/domain name?

I my website is hosted at this http://www.mydomain.com or
http://mysub.mydomain.com/dir/ then I want to get this:
http://www.mydomain.com or (in sample 2) http://mysub.mydomain.com/

How can I realise that?

Thanks!


Nov 18 '05 #4
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/de...mitertopic.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
--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl*********@news4.zwoll1.ov.home.nl...
I found now also this one:
request.ServerVariables("SERVER_NAME")

Is this one not better?

Thanks
"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> schreef in bericht news:ed**************@TK2MSFTNGP15.phx.gbl...
There are a number of ways to get this,

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

is a good one...

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
"Arjen" <bo*****@hotmail.com> wrote in message
news:cl**********@news2.zwoll1.ov.home.nl...
Hello,

How can I get the current host/domain name?

I my website is hosted at this http://www.mydomain.com or
http://mysub.mydomain.com/dir/ then I want to get this:
http://www.mydomain.com or (in sample 2) http://mysub.mydomain.com/

How can I realise that?

Thanks!



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bilal | last post by:
Hi, I have a web application that operates on several windows. Each window is named win_1, win_2, win_3,... . When I quit a session, I usually loop through all the windows and close one by one. So...
9
by: Jeff | last post by:
Is there a way to echo back a case sensitive $HTTP_HOST in PHP? For example if I type HostName.domain.com in my browser I want to return it exactly as it appears in the location part of the browser...
1
by: Frogbčrt | last post by:
Config: Win2K, IIS5.0 My solution requires that the host header sent to IIS be analyzed. I have set up a web site that responds to both www.domain.com and domain.com. In DNS, both a WWW and a *...
1
by: Stefan | last post by:
I'm installing Oracle 9ias Release 2 on Windows 2000 Advanced Server. The installation instructions say to specify a fully qualified host name for the machine. What is the definition of fully...
2
by: Jeff S | last post by:
What are my options if I want to host hundreds of sites on one IIS server (like Internet presence providers do); such that site1.com, site2.com, site3.com... site278.com... are all hosted on the...
1
by: Stephane | last post by:
Hi, Is there a way to know what exactly a hostname is? Per example, we can have the domain « domain.qc.ca » and it could come in one of those forms: www.domain.qc.ca sub.domain.qc.ca...
1
by: Neo Geshel | last post by:
I know this probably OT, but I need to know if there is any way to “upgrade” the host header system of IIS 6 (Win 2003) to accept internationalized domain names. That is, domain names with...
2
by: DanWeaver | last post by:
I am about to launch a site using Ajax, ASP, SQL (Built using SQLExpress) & Client side javascript. I have the following uncertainties: 1) My page is a mess in Firefox having been written using...
2
by: best_hosting | last post by:
Top 10 Things To Look For In A Web Host http://hosting-top10.blogspot.com/2008/07/top-10-things-to-look-for-in-web-host.html 5 Tips To Choose A Domain Name For An Internet Business...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.