Getting domain from request

  • Thread starter Thread starter David Dvali
  • Start date Start date
Use Request.Uri.GetLeftPart(UriPartial.Authority) . Or
UriPartial.Something else.

Grtz, Wouter vanVugt
blogs.infosupport.com/wouterv
 
Absolutely correct, although there's a couple of gotchas to watch out for.

Dim Url1 As String = Request.Url.ToString
Dim FQDN As New Uri(Url1)
Dim dns As String
dns = FQDN.GetLeftPart(UriPartial.Authority)

Of course, if only the raw domain name is wanted, use :
Dim dnsname As String = Request.Url.Host



Juan T. Llibre, ASP.NET MVP
ASP.NET FAQ : http://asp.net.do/faq/
Foros de ASP.NET en Español : http://asp.net.do/foros/
======================================
 

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

Back
Top