Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I tell what page I'm on - from an include file?

Status
Not open for further replies.

DennisTheMenace

IS-IT--Management
Jul 25, 2001
113
US
I have the header, menu & footer on most of my pages set up as an include:

<!-- #include file=&quot;incls/includeheader.asp&quot; -->
<!-- #include file=&quot;incls/includemenu.asp&quot; -->
...
<!-- #include file=&quot;incls/includefooter.asp&quot; -->

Does anyone know how I can tell what page I am on so that in my header, I can exclude a piece of information?

For example, if I am on my secure page ( for payment, I do NOT want a paid banner's advertisement loading ( from his site (or you get the secure and unsecure information warning- which is usually OK... but alot of shoppers don't understand it). =====================
Dennis B

Remember - YOU ARE UNIQUE!!!... Just like EVERYONE ELSE! ;o)
 
Try the following..
Code:
Request.ServerVariables(&quot;HTTPS&quot;)
That will return On or Off. That's supposed to be all CAPS but for some reason this forum is putting the http part in lower case.

ASP can't return the entire URL string that I know of. Only JavaScript can do that with the location.href property.
Code:
Request.ServerVariables(&quot;SCRIPT_NAME&quot;)
That will return the script name and path. But not the portion. But will tell you what page is being processed.

ToddWW
 
More specifically,
Code:
IF Request.ServerVariables(&quot;HTTPS&quot;) = &quot;Off&quot; THEN
  'do something
ELSE
  'do something else
END IF

ToddWW
 
Thanks Todd!

I wanted to do more than just the HTTPS though. :-( That was just one example (and an easy one to understand).

Another comes to mind is that I don't need the &quot;basket summary&quot; to show up in the corner of the page (thats a waste of calls to the sql server) when you are actually viewing the basket page. So... taking your advice from your first reply...

I threw this on TEST.ASP:
<% myScriptName = Request.ServerVariables(&quot;SCRIPT_NAME&quot;)%>
<CENTER> <%=myScriptName%> </CENTER>

and it returned: /test.asp

Perfectly centered on the page! *<|:) THANKS again Todd! Nice work you do here! =====================
Dennis B

Remember - YOU ARE UNIQUE!!!... Just like EVERYONE ELSE! ;o)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top