#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    9
    Rep Power
    0

    how do i display the current URL


    hi,
    i'd like to know how to display the current URL on the web page as a footer. This seems to be a fairly simple task, but everything i've found on the internet either doesn't work for some reason, or is asp.net specific.
    Any suggestions would be great.

    cheers
    j
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Canada - Egypt
    Posts
    60
    Rep Power
    12

    Server Variables


    You could combine the SERVER_NAME and URL

    something like


    <% Response.write( "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") )%>

    You could check the PORT variable to find out if it is http or https

    This link lists all the server variables


    There is another way using server map path or something similar , but I cannot remember the exact code for it.

    Hope this is helpful.
    I hope this is of any help to anyone.

    Yassoor
    http://www.WebsitesCreation.ca
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    9
    Rep Power
    0

    thanks, but it is not quite right


    thanks yassoor.

    its on the right track, but only gives :

    http://csiis.leeds.ac.uk/cbxjrs/page1.asp


    when i want it to show the full url including extra values, etc :

    http://csiis.leeds.ac.uk/cbxjrs/page..._id=7#Building

    how do i show the rest?

    j
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Location
    Canada - Egypt
    Posts
    60
    Rep Power
    12
    One of the Request serve variables is QUERY_STRING

    so it would be something like

    Response.write( "http://" & Request.ServerVariables("SERVER_NAME") & Request.ServerVariables("URL") ) & "?" & Request.ServerVariables("QUERY_STRING") ) %>

    Read more about those Request.ServerVariables there is alot of info about them .. a simple search on google for "Request.ServerVariables" will return a lot of hits ...


    Another path is to use javascript (client side) .. I am sure it would be a lot easier that way.


    I hope this is of any help.
    I hope this is of any help to anyone.

    Yassoor
    http://www.WebsitesCreation.ca
  8. #5
  9. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    9
    Rep Power
    0

    Thanks very much


    Thanks yassoor.

    thats a great help

    j

IMN logo majestic logo threadwatch logo seochat tools logo