Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Get host/domain name

Reply
Thread Tools

Get host/domain name

 
 
Arjen
Guest
Posts: n/a
 
      10-24-2004
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!


 
Reply With Quote
 
 
 
 
Karl
Guest
Posts: n/a
 
      10-24-2004
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" <(E-Mail Removed)> wrote in message
news:clha1j$qkg$(E-Mail Removed)1.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!
>
>



 
Reply With Quote
 
 
 
 
Arjen
Guest
Posts: n/a
 
      10-24-2004
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:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:clha1j$qkg$(E-Mail Removed)1.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!
> >
> >

>
>



 
Reply With Quote
 
Arjen
Guest
Posts: n/a
 
      10-24-2004
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:(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:clha1j$qkg$(E-Mail Removed)1.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!
> >
> >

>
>



 
Reply With Quote
 
Karl
Guest
Posts: n/a
 
      10-24-2004
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" <(E-Mail Removed)> wrote in message
news:clhccf$f0$(E-Mail Removed)1.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:(E-Mail Removed)...
> > 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" <(E-Mail Removed)> wrote in message
> > news:clha1j$qkg$(E-Mail Removed)1.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!
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
djProduct djProduct is offline
Junior Member
Join Date: Nov 2008
Posts: 1
 
      11-10-2008
Quote:
Originally Posted by Arjen
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
adding a variable name to a hash to name is part of the variable name Bobby Chamness Perl 2 04-22-2007 09:54 PM
print("my name is {name}, and {age}-year old {gender}", name, age, gender); =?iso-8859-1?B?bW9vcJk=?= Java 7 01-02-2006 04:39 PM
IE name="name" & form.name property bug Java script Dude Javascript 5 06-30-2004 03:07 AM
name = name.substring(0, name.lastIndexOf('.')); Help please Jack-2 Javascript 3 12-24-2003 04:39 PM
Re: Urgent! how to get object name, method name and attribute name based on the strings? ding feng C++ 2 06-25-2003 01:18 PM



Advertisments