Requesting URL

Discussion in 'ASP General' started by David de Jong, Aug 14, 2003.

  1. Does anyone how to get the url in e.g. http://localhost/dev/a/test.asp?id=1
    (so I get test.asp). I've tried <% request.ServerVariables("URL") %> but it
    returns /dev/a/test.asp, so far I've also heard to use InstrRev, but I don't
    know how to use it....

    TIA
     
    David de Jong, Aug 14, 2003
    #1
    1. Advertising

  2. if strcomp(Request.ServerVariables ("HTTPS"), "ON", 1) = 0
    then
    sURL = "https://"
    else
    sURL = "http://"
    end if
    sURL = sURL & Request.ServerVariables ("SERVER_NAME")
    sURL = sURL & Request.ServerVariables ("SCRIPT_NAME")
    if len(trim(Request.QueryString)) > 0 then
    sURL = sURL & "?" & Request.QueryString
    end if

    Response.Write sURL

    >-----Original Message-----
    >Does anyone how to get the url in e.g.

    http://localhost/dev/a/test.asp?id=1
    >(so I get test.asp). I've tried <% request.ServerVariables

    ("URL") %> but it
    >returns /dev/a/test.asp, so far I've also heard to use

    InstrRev, but I don't
    >know how to use it....
    >
    >TIA
    >
    >
    >.
    >
     
    Adrian Forbes - MVP, Aug 14, 2003
    #2
    1. Advertising

  3. David de Jong

    Ray at Guest

    Oops. This answer will not be enough to get the result you want.

    I think this will work.
    <%
    sScript = Request.ServerVariables("SCRIPT_NAME")
    aScript = Split(sScript, "/")
    sScript = aScript(UBound(aScript))

    Response.write sScript
    %>

    Ray at work

    "Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
    news:...
    > <%
    >
    > For Each x in Request.ServerVariables
    > Response.Write x & " = " & Request.ServerVariables(x) & "<br>"
    > Next
    >
    > %>
    >
    > Make a page with that code and take a look at the available server
    > variables.
    >
    > Ray at work
    >
    > "David de Jong" <news_jonggoud@@@jonggoud.nl> wrote in message
    > news:7QL_a.15411$tK5.2006383@zonnet-reader-1...
    > > Does anyone how to get the url in e.g.

    > http://localhost/dev/a/test.asp?id=1
    > > (so I get test.asp). I've tried <% request.ServerVariables("URL") %> but

    > it
    > > returns /dev/a/test.asp, so far I've also heard to use InstrRev, but I

    > don't
    > > know how to use it....
    > >
    > > TIA
    > >
    > >

    >
    >
     
    Ray at, Aug 14, 2003
    #3
  4. Thanks, this seems to work, I have to say that I didn;t think of this
    solution yet,
    David
    "Adrian Forbes - MVP" <> wrote in message
    news:0ff201c36266$43b334b0$...
    > if strcomp(Request.ServerVariables ("HTTPS"), "ON", 1) = 0
    > then
    > sURL = "https://"
    > else
    > sURL = "http://"
    > end if
    > sURL = sURL & Request.ServerVariables ("SERVER_NAME")
    > sURL = sURL & Request.ServerVariables ("SCRIPT_NAME")
    > if len(trim(Request.QueryString)) > 0 then
    > sURL = sURL & "?" & Request.QueryString
    > end if
    >
    > Response.Write sURL
    >
    > >-----Original Message-----
    > >Does anyone how to get the url in e.g.

    > http://localhost/dev/a/test.asp?id=1
    > >(so I get test.asp). I've tried <% request.ServerVariables

    > ("URL") %> but it
    > >returns /dev/a/test.asp, so far I've also heard to use

    > InstrRev, but I don't
    > >know how to use it....
    > >
    > >TIA
    > >
    > >
    > >.
    > >
     
    David de Jong, Aug 14, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Charles A. Lackman

    Requesting Page??

    Charles A. Lackman, Aug 23, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    346
  2. Jon paugh
    Replies:
    1
    Views:
    961
  3. magic kat

    How to get the requesting URL

    magic kat, Jul 26, 2007, in forum: ASP .Net
    Replies:
    1
    Views:
    428
    Mark Rae [MVP]
    Jul 26, 2007
  4. Just D.
    Replies:
    0
    Views:
    560
    Just D.
    Aug 11, 2004
  5. Replies:
    3
    Views:
    118
    aonic
    Aug 20, 2007
Loading...

Share This Page