Get page name without folder details

Discussion in 'ASP General' started by Colin Steademan, Feb 3, 2004.

  1. Is there a method of returning the name of the current URL, without any of the path details? I am currently using request.serverVariables("url"), but this returns the name of the page and its path. This is forces me to use the following IF statement to get my page to work correctly

    <
    If request.serverVariables("url") = "/pp/DEV/messages.asp" Then ..
    %

    This works fine. But since the URL is hard-coded, when I move my development pages to live I am forced to go in and change the script (and others) as follows

    <
    If request.serverVariables("url") = "/pp/LIVE/messages.asp" Then ..
    %

    I've looked at the other serverVariables available but none seem to just return the name of the page. Can anyone suggest a remedy for this

    TIA

    Coli
     
    Colin Steademan, Feb 3, 2004
    #1
    1. Advertising

  2. Colin Steademan

    Alex Goodey Guest

    If Right(request.serverVariables("url"),
    Len(request.serverVariables("url"))-InStrRev(request.serverVariables("url"),
    "/")) = "messages.asp" then

    "Colin Steademan" <> wrote in
    message news:...
    > Is there a method of returning the name of the current URL, without any of

    the path details? I am currently using request.serverVariables("url"), but
    this returns the name of the page and its path. This is forces me to use
    the following IF statement to get my page to work correctly :
    >
    > <%
    > If request.serverVariables("url") = "/pp/DEV/messages.asp" Then ...
    > %>
    >
    > This works fine. But since the URL is hard-coded, when I move my

    development pages to live I am forced to go in and change the script (and
    others) as follows:
    >
    > <%
    > If request.serverVariables("url") = "/pp/LIVE/messages.asp" Then ...
    > %>
    >
    > I've looked at the other serverVariables available but none seem to just

    return the name of the page. Can anyone suggest a remedy for this?
    >
    > TIA,
    >
    > Colin
    >
     
    Alex Goodey, Feb 3, 2004
    #2
    1. Advertising

  3. ----- Alex Goodey wrote: -----

    If Right(request.serverVariables("url"),
    Len(request.serverVariables("url"))-InStrRev(request.serverVariables("url"),
    "/")) = "messages.asp" then


    Thankyou!
     
    Colin Steadman, Feb 3, 2004
    #3
  4. Colin Steademan

    Evertjan. Guest

    =?Utf-8?B?Q29saW4gU3RlYWRlbWFu?= wrote on 03 feb 2004 in
    microsoft.public.inetserver.asp.general:

    > <%
    > If request.serverVariables("url") = "/pp/LIVE/messages.asp" Then ...
    > %>
    >
    > I've looked at the other serverVariables available but none seem to
    > just return the name of the page. Can anyone suggest a remedy for
    > this?


    Think the other way around and test for:


    If InStr(request.serverVariables("url"),"/messages.asp")>0 Then

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
     
    Evertjan., Feb 3, 2004
    #4
  5. > > <%
    > > If request.serverVariables("url") = "/pp/LIVE/messages.asp" Then ...
    > > %>
    > >
    > > I've looked at the other serverVariables available but none seem to
    > > just return the name of the page. Can anyone suggest a remedy for
    > > this?

    >
    > Think the other way around and test for:
    >
    >
    > If InStr(request.serverVariables("url"),"/messages.asp")>0 Then




    Rats! That is a nice elegant solution. I'm disappointed I didn't
    think of it myself, I really could and should have!

    Thankyou.

    Colin
     
    Colin Steadman, Feb 3, 2004
    #5
    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. =?Utf-8?B?Sm9l?=

    Show Details/Hide Details link button

    =?Utf-8?B?Sm9l?=, Mar 13, 2006, in forum: ASP .Net
    Replies:
    1
    Views:
    911
    dkode
    Mar 13, 2006
  2. ding feng
    Replies:
    2
    Views:
    2,826
    ding feng
    Jun 25, 2003
  3. DC
    Replies:
    0
    Views:
    383
  4. Rob

    Display folder/file details

    Rob, Jul 13, 2003, in forum: ASP General
    Replies:
    1
    Views:
    169
    Bullschmidt
    Jul 14, 2003
  5. JW

    Protected folder login details

    JW, Sep 28, 2003, in forum: ASP General
    Replies:
    3
    Views:
    135
    Phillip Windell
    Oct 1, 2003
Loading...

Share This Page