WebRef.eu  - Internet Marketing and Online Business Resources  

Home / Site Map | Contact


Coding A Page Dependence in ASP Classic

If you need some ASP code to execute only on a given page, the way to do this is with a statement like:

If InStr(Request.ServerVariables("SCRIPT_NAME"), "yourpagename.asp") = 0 Then

where you should substitute "yourpagename.asp" with the actual name of your .asp page.

The InStr function returns the position of a given string (in this case "yourpagename.asp") within another (in this case Request.ServerVariables("SCRIPT_NAME")). InStr will return 0 when each string is exactly the same.

An example usage of this is to highlight the page name when you are on that page, by substituting a particular image only on that page.


Low Prices UK Shopping

Compare Prices
at LowPrices.co.uk

Home / Site Map | Contact

All Content ©2020 WebRef.eu