Home|Sitemap|Contact

How can you check for registration without back button problems?

The problem was that when a page checked to see if a person had registered prior to viewing protected content, the person would be sent to the registration page. If the person failed to register their browser's history would include the protected page and the registration page. What was needed was a way to redirect the user to the registration page and control their browser's history so as to not repeatedly redirect them to the registration page.  In other words, once the user indicates they do not wish to register, do not allow them to go back to that page.
EXAMPLE: Click link to product page.

Click Here For the Product 1 Page.
Click Here For the Product 2 Page.



<%
'*************************************************
'* AT THE BEGINING OF EVERY PRODUCT PAGE
'*************************************************
Dim fromPage
fromPage = request.servervariables("HTTP_REFERER")

if session("registration")="" then
server.transfer("tregistration.asp") 
elseif session("registration")=false then
response.redirect fromPage 
end if
%>
<%
'*************************************************
'* REGISTRATION PAGE
'*************************************************
if LCase(request.servervariables("HTTP_METHOD"))="get" then
  productPage = request.servervariables("SCRIPT_NAME")
  callingPage = request.servervariables("HTTP_REFERER")
else
  response.write "POST"
  '**********************************************
  '* DATABASE OR COOKIE ROUTINES HERE
  '**********************************************
  productPage = request.form("from")

  '* IF THEY DID NOT REGISTER (YOU COULD REMOVE THIS)
  if request.form("register")="false" then
    session("registration")=false
    response.redirect request.form("call")
  '* IF THEY REGISTERED CORRECTLY
  elseif request.form("register")="true" then
    session("registration")=true
    server.transfer request.form("from")
  end if
end if 
%>
<html>
<body>
<form name="regform" method="post" action="tregistration.asp">
<!-- ADD WHATEVER FIELDS YOU NEED HERE, MAINTAIN HIDDEN FIELDS -->
<input type="radio" value="true" checked name="register">Register&nbsp;&nbsp;<input type="radio" name="register" value="false">Don't Register<br>
<input type="hidden" name="from" value="<%=productPage%>"><br>
<input type="hidden" name="call" value="<%=callingPage%>"><br>
<input type="submit" name="submit" value="submit">
</form>
</body>
</html>
  


Most Popular Pages On rodsdot.com

Client Side Includes Using JavaScript
Creating A JavaScript Slider Input in JavaScript
Creating Conditional Links With ASP
Dynamically Adding Rows and Fields To A Table Based Form
Geo-Coding IP Addresses
How To Make A Pop Over Menu
JavaScript Date Validation DD/MM/YYYY
JavaScript Date Validation MM/DD/YYYY
Parameterized SQL Using Multiple Form Inputs and Filtering
Play A WAV File On Mouseover
Pop Over Form
Resorting A Multi-Dimensional Table Using Client-Side JavaScript
Scripting Remote Images in JavaScript
Using AJAX to Return HTML For Dynamic Forms
Using Images For CAPTCHA
Using Parameterized SQL with ASP and MS Access
Why JavaScript As The HREF Of A Link Is Bad