473,320 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

Jul 19 '05 #1
4 4041
If Right(request.serverVariables("url"),
Len(request.serverVariables("url"))-InStrRev(request.serverVariables("url"),
"/")) = "messages.asp" then

"Colin Steademan" <ms**@N0Tpart0FemailADDRESScolinsteadman.com> wrote in
message news:90**********************************@microsof t.com...
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

Jul 19 '05 #2
=?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)
Jul 19 '05 #3


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

If Right(request.serverVariables("url"),
Len(request.serverVariables("url"))-InStrRev(request.serverVariables("url"),
"/")) = "messages.asp" then
Thankyou!
Jul 19 '05 #4
> > <%
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
Jul 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Glenn A. Harlan | last post by:
Why am I receiving the below error when calling - Path.GetTempFileName() The directory name is invalid. Description: An unhandled exception occurred during the execution of the current web...
4
by: CW | last post by:
I just took an extensive ASP.NET course and copied my projects to my wwwroot folder and tried opening my default page which consumes some web service. It worked ok at the course but now I get this...
11
by: Jeff | last post by:
Hi - I'm trying to get my ASP.NET pages to work the same way on my development machine (running from the VS.NET IDE) and on a remote (3rd-party) server. The only way I've been able to come up...
6
by: Tony Doyle | last post by:
All, I have a web form with 3 embedded panels, all working fine. However, I have now added a Checkbox where autopostback=true, and only the ascx pages on my page appear, none of the panels /...
7
by: Alan Silver | last post by:
Hello, Sorry this is a bit wordy, but it's a pretty simple question... I have a web site, http://domain/ which is a public site, part of which (http://domain/a/) is protected by forms...
7
by: John Morgan | last post by:
I have done a fair amount of programming of ASP.NET 1.1 without poroblem I am now involved in my first project with ASP.NET 2.0 and I am having difficulties with understanding the compilation or...
12
by: John Kotuby | last post by:
Hi all, Maybe this is a simple problem found in ASP.NET 2.0 course 101, but I must have missed it. When I create a page in Visual Web Developer and use URLs like "/images/picture.gif " or a link...
15
denny1824
by: denny1824 | last post by:
I have a working website. I copied all the files to a new folder in inetpub/wwwroot and then set that folder as a Virtual Directory in IIS. I try going to that site from the new folder and i am...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.