Get the domain name of the website in ASP.NET
- 2020-05-05 11:05:11
- OfStack
Dim url, host_url no_http, host_name As String 'defines the variable
url = HttpContext. Current. Request. Url. ToString 'URL
obtains a handle to the current page
no_http = url.Substring (url.IndexOf ("//")) + 2 Intercept 'to remove HTTP:// URL
host_url = "http://" & no_http.Substring (0, no_http.IndexOf ("/") + 1) 'combines to form the domain name