How do I get root url using ASP not ASP.net
Classic ASP had a Request.ServerVariables collection that contained all server and environment details. Here's what the classic ASP version of the example .NET code looks like:
function getSiteRootUrl()
dim siteRootUrl, protocol, hostname, port
if Request.ServerVariables("HTTPS") = "off" then
protocol = "http"
else
protocol = "https"
end if
siteRootUrl = protocol & "://"
hostname = Request.ServerVariables("HTTP_HOST")
siteRootUrl = siteRootUrl & hostname
port = Request.ServerVariables("SERVER_PORT")
if port <> 80 and port <> 443 then
siteRootUrl = siteRootUrl & ":" & port
end if
getSiteRootUrl = siteRootUrl
end function