Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 1st, 2006, 10:10 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default Requesting PAGE name

Hi,
Is it possible to request the name of a page?
So for eg: if it's page1 I execute code1 and if it's page2 I can execute code2 (using inc files).

Any help appreciated.:)

  #2 (permalink)  
Old June 1st, 2006, 10:17 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

How about this?

<%
myPage= Request.ServerVariables("PATH_INFO")
    x=split(myPage,"/")
    currPage=x(uBound(x))
    response.write currPage
%>

Earl
www.jhdesigninc.com
  #3 (permalink)  
Old June 2nd, 2006, 09:02 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks,
How would I apply it to an IF statement? I've no idea as to where this code fits in with mine...(sorry).
Would it be
IF PAGE (your code) = page1
Then CODE1
ELSE
Code2
?

Hope to hear again.

  #4 (permalink)  
Old June 3rd, 2006, 05:36 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Tried the above code from erobb. This only displays the current page displayed.
I need help with the following scenario:
I have Form1.asp & Form2.asp and results.asp

So depending on which page/form is submitted the results page with execute a code.

How can I get results.asp to know which page/form has been submitted.
Thanks again.

  #5 (permalink)  
Old June 3rd, 2006, 06:08 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

My bad, on your results.asp page put

<%
response.write request.ServerVariables("HTTP_REFERER")
%>

This will show you which page in your web site a user came from.

Earl
www.jhdesigninc.com

  #6 (permalink)  
Old June 3rd, 2006, 06:56 AM
Authorized User
 
Join Date: May 2006
Location: Bradford, , United Kingdom.
Posts: 49
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks again: heres my final code that works now (finally):
<%
Dim wpage, mypage
wpage = request.ServerVariables("HTTP_REFERER")
mypage = Right(wpage, 8)

If mypage = "Managers" Then
    Response.write "This is the Managers page"
  Else
    Response.write "This is the Workers page"
  End If
%>

  #7 (permalink)  
Old June 4th, 2006, 08:23 AM
Authorized User
 
Join Date: Jun 2003
Location: Richmond, VA, USA.
Posts: 79
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to erobb Send a message via Yahoo to erobb
Default

Im glad it worked out for you. If you wanted to make it a little more dynamic. Say the manager page name changed to mypage.asp your call to Right(wpage, 8) would not work appropriately.

<%

    Dim wpage, mypage
    function whatPage(urlString)
        x=split(myPage,"/")
        currPage=x(uBound(x))
        whatPage=currPage
    end function


    mypage = request.ServerVariables("HTTP_REFERER")
    if mypage <>"" then
        mypage= whatPage(request.ServerVariables("HTTP_REFERER"))
    end if

    If mypage = "Managers.asp" Then
        Response.write "This is the Managers page"
      Else
        Response.write "This is the Workers page"
     End If
%>

It may seem like a bit of over kill but from a scalabilty point of view this will work out better in the long run.

Earl



Similar Threads
Thread Thread Starter Forum Replies Last Post
Requesting Help Theapp1e Java Basics 7 May 7th, 2008 02:06 AM
Problems when requesting next page VilariƱo Crystal Reports 1 June 19th, 2007 12:57 PM
Requesting Data Input from Operator Ralph Weikert MySQL 0 May 5th, 2006 09:48 PM
Problem in requesting certificate bhupi_josh BOOK: ASP.NET Website Programming Problem-Design-Solution 0 August 5th, 2005 02:38 AM
posting/requesting data from web server page one5 .NET Web Services 2 July 28th, 2003 03:14 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.