[thelist] asp regexp/substring

Scott Dexter sgd at ti3.com
Fri Oct 26 10:12:11 CDT 2001


> strFromPage = request.servervariables("HTTP_REFERER")
> which gives
> http://thedomain.com/somefolder/thepage.asp
> 
> how do I check if "thepage" is the name of the page?
> 

I'd do something near this:

<%
' just in case I want to use the other parts of the URI, let's hold on
to them
refererarray = split(request.servervariables("HTTP_REFERER"), "/")
' grab the filename, which is at the end
pagename = refererarray(ubound(refererarray))
' want it without the extension?
pagename_noext = left(pagename, InStr(pagename,"."))
%>

note there are numerous caveats to using the referer, so if you *really*
need the previous page's name, I'd stick it in the query string or in a
cookie....

sgd




More information about the thelist mailing list