Request.ServerVariables("HTTP_URL") How to get full URL string?

Posted on 2005-04-18
Last Modified: 2012-08-13
Hi All,

I am trying to get the full url of a page, not having any luck in finding the correct code.

I am aware of these 2, but I need to get the full string that’s in the address bar of a page.


Is there any other code that could pull the whole string?

Thank you.

Question by:Tony-laptops
    LVL 33

    Accepted Solution

    You can use these 3 combinations

    Request.ServerVariables("HTTP_HOST") & Request.ServerVariables("URL") & Request.ServerVariables("QUERY_STRING")
    LVL 33

    Expert Comment

    Think this is better

    Response.Write "http://"
    Response.Write Request.ServerVariables("HTTP_HOST")
    Response.Write Request.ServerVariables("URL")
    if Request.ServerVariables("QUERY_STRING") <> "" then
          Response.Write "?" & Request.ServerVariables("QUERY_STRING")
    end if

    LVL 33

    Expert Comment

    If in JavaScript,

    <script language="JavaScript">

    LVL 2

    Expert Comment

    found this
        prot = "http" 
        https = lcase(request.ServerVariables("HTTPS")) 
        if https <> "off" then prot = "https" 
        domainname = Request.ServerVariables("SERVER_NAME") 
        filename = Request.ServerVariables("SCRIPT_NAME") 
        querystring = Request.ServerVariables("QUERY_STRING") 
        response.write prot & "://" & domainname & filename & "?" & querystring 

    Open in new window


    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Join & Write a Comment

    I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
    This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now