[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 578
  • Last Modified:

Using Request.ServerVariables("HTTP_REFERER")

Hello everyone

I have a piece of code that came from EE which I sort of understand. However, I don't know how to expand on it.

The code is:

<% If Right(Request.ServerVariables("HTTP_REFERER"),24) = "20yearsTrustMessages.asp" Then

Response.Write("<div id='goBack'><a href='javascript:back()' class='goBack'>[ Return to the previous page ]</a></div>")

End If %>

It works fine if referer is '20yearsTrustMessages.asp' but we now use Recordset Paging and the extension can be followed by '?offset=...'. with the figure after the = varying (-1, 0 ,10, 20 etc).

I don't know how to change the referer to reflect '?offset=...' if it's there. I thought of using a wildcard but I don't know how to use them.

Can you help me out?
0
Martin Cotterill
Asked:
Martin Cotterill
1 Solution
 
MorcalavinCommented:
You probably want to use a regular expression.  I'm on my way out the door, so this is a quick hack of one.  Someone else can probably provide a better working example that will meet all the instances you want:

<%
dim re
set re = new RegExp
re.IgnoreCase = true
re.Global = false
re.Pattern = "^.*20yearsTrustMessages.asp(\?offset=.*)?$"
if re.test(Request.ServerVariables("HTTP_REFERRER")) then
'do whatever here
end if
%>

Open in new window

0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now