Connecting Tech Pros Worldwide Forums | Help | Site Map

Get page name without folder details

Colin Steademan
Guest
 
Posts: n/a
#1: Jul 19 '05
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


Alex Goodey
Guest
 
Posts: n/a
#2: Jul 19 '05

re: Get page name without folder details


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

"Colin Steademan" <msdn@N0Tpart0FemailADDRESScolinsteadman.com> wrote in
message news:90E24EB1-BDC0-4F63-A003-82EF6849B1F8@microsoft.com...[color=blue]
> Is there a method of returning the name of the current URL, without any of[/color]
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 :[color=blue]
>
> <%
> If request.serverVariables("url") = "/pp/DEV/messages.asp" Then ...
> %>
>
> This works fine. But since the URL is hard-coded, when I move my[/color]
development pages to live I am forced to go in and change the script (and
others) as follows:[color=blue]
>
> <%
> If request.serverVariables("url") = "/pp/LIVE/messages.asp" Then ...
> %>
>
> I've looked at the other serverVariables available but none seem to just[/color]
return the name of the page. Can anyone suggest a remedy for this?[color=blue]
>
> TIA,
>
> Colin
>[/color]


Evertjan.
Guest
 
Posts: n/a
#3: Jul 19 '05

re: Get page name without folder details


=?Utf-8?B?Q29saW4gU3RlYWRlbWFu?= wrote on 03 feb 2004 in
microsoft.public.inetserver.asp.general:
[color=blue]
> <%
> 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?[/color]

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)
Colin Steadman
Guest
 
Posts: n/a
#4: Jul 19 '05

re: Get page name without folder details




----- Alex Goodey wrote: -----

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


Thankyou!
Colin Steadman
Guest
 
Posts: n/a
#5: Jul 19 '05

re: Get page name without folder details


> > <%[color=blue][color=green]
> > 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?[/color]
>
> Think the other way around and test for:
>
>
> If InStr(request.serverVariables("url"),"/messages.asp")>0 Then[/color]



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
Closed Thread