Click to See Complete Forum and Search --> : URL of current page


jrthor2
04-16-2003, 10:06 AM
I have the following code to get the url of my page:

function URL()
URL= "http://" & Request.serverVariables("SERVER_NAME") & _
Request.serverVariables("PATH_INFO")
End function

The problem is, is if I'm on a page where the url looks like this:

http://www.server.org/Members/index.asp?sortby=R&order=1&name=admin

It doesn't grab anything from the ? on. How can I get that info also?

Thanks!!

DaiWelsh
04-16-2003, 10:30 AM
PATH_INFO only refers to info after a / not a ?, I think you can access the whole query string (bit after ?) with Request.serverVariables("REQUEST_STRING") though you will need to check a reference, but it is more usual to access the seperate variables in the query string, e.g. in your example there would be variables created for you by ASP called 'sortby' 'order' and name'. You can access these a couple of ways but an example would be Request('sortby').Value

jrthor2
04-16-2003, 10:45 AM
When using the Request("sortby").Value, I get

Object doesn't support this property or method: 'Value'

DaiWelsh
04-17-2003, 07:56 AM
My bad, forget the .value just use

Request("sortby")

or if you want to make sure you gte the parameter from the url (as opposed to from a form)

Request.QueryString("sortby")

Perils of using multiple languages, the code does not flow so well from memory (that is what references are for).

HTH,

Dai