Get host/domain name

Discussion in 'ASP .Net' started by Arjen, Oct 24, 2004.

  1. Arjen

    Arjen Guest

    Arjen, Oct 24, 2004
    #1
    1. Advertising

  2. Arjen

    Karl Guest

    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" <> wrote in message
    news:clha1j$qkg$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!
    >
    >
    Karl, Oct 24, 2004
    #2
    1. Advertising

  3. Arjen

    Arjen Guest

    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:...
    > 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" <> wrote in message
    > news:clha1j$qkg$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!
    > >
    > >

    >
    >
    Arjen, Oct 24, 2004
    #3
  4. Arjen

    Arjen Guest

    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:...
    > 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" <> wrote in message
    > news:clha1j$qkg$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!
    > >
    > >

    >
    >
    Arjen, Oct 25, 2004
    #4
  5. Arjen

    Karl Guest

    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


    --
    MY ASP.Net tutorials
    http://www.openmymind.net/


    "Arjen" <> wrote in message
    news:clhccf$f0$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:...
    > > 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" <> wrote in message
    > > news:clha1j$qkg$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!
    > > >
    > > >

    > >
    > >

    >
    >
    Karl, Oct 25, 2004
    #5
  6. Arjen

    djProduct

    Joined:
    Nov 10, 2008
    Messages:
    1
    SchemeDelimiter

    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
    djProduct, Nov 10, 2008
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Joey
    Replies:
    0
    Views:
    333
  2. Orpheus66
    Replies:
    0
    Views:
    4,394
    Orpheus66
    Jul 30, 2003
  3. Anil G
    Replies:
    4
    Views:
    22,774
    v_parthi
    Jan 31, 2008
  4. mohammed_a_o
    Replies:
    0
    Views:
    256
    mohammed_a_o
    Nov 30, 2010
  5. Chem Leakhina
    Replies:
    2
    Views:
    128
    Robert Klemme
    Jun 23, 2009
Loading...

Share This Page