Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 19th, 2005, 11:38 AM
Colin Steademan
Guest
 
Posts: n/a
Default Get page name without folder details

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

  #2  
Old July 19th, 2005, 11:38 AM
Alex Goodey
Guest
 
Posts: n/a
Default 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]


  #3  
Old July 19th, 2005, 11:38 AM
Evertjan.
Guest
 
Posts: n/a
Default 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)
  #4  
Old July 19th, 2005, 11:38 AM
Colin Steadman
Guest
 
Posts: n/a
Default 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!
  #5  
Old July 19th, 2005, 11:39 AM
Colin Steadman
Guest
 
Posts: n/a
Default 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
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles