Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I get the current domain in Classic ASP?

Tags:

asp-classic

I want to get the current domain so if the page is http://www.domain.com/page.asp I need www.domain.com

like image 763
Andrew G. Johnson Avatar asked Jan 27 '10 17:01

Andrew G. Johnson


1 Answers

Request.ServerVariables("SERVER_NAME")'

To be complete, one of my functions:

  function PageUrl
     dim sPort
     sPort = Request.ServerVariables("SERVER_PORT")
     if sPort = "80" then
        sPort = ""
     else
        sPort = ":" & sPort
     end if

     PageUrl = "http://" & Request.ServerVariables("SERVER_NAME") & sPort & _
                           Request.ServerVariables("URL") & "?" & _
                           Request.ServerVariables("QUERY_STRING")
  end function
like image 119
Edelcom Avatar answered Oct 23 '22 08:10

Edelcom