p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Register | FAQ | Members List | Calendar | 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 p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 1st, 2006, 11: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.:)

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old June 1st, 2006, 11:17 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #3 (permalink)  
Old June 2nd, 2006, 10: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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #4 (permalink)  
Old June 3rd, 2006, 06: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.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #5 (permalink)  
Old June 3rd, 2006, 07:08 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #6 (permalink)  
Old June 3rd, 2006, 07: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
%>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #7 (permalink)  
Old June 4th, 2006, 09:23 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

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



All times are GMT -4. The time now is 03:24 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc