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 John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deny Access to a Visted WebPage

Status
Not open for further replies.

aumstu

MIS
Jan 20, 2006
40
US
I am designing a survey and once the user leaves the first page...I do not want them to be able to go back and resubmit the form again. I have disabled the back button by using the following code

<script>
history.forward();
</script>

Since the user has to login, I have it coded in the database once the complete the survey. But here is my problem. Once the user goes to the second part of the survey, they can get back to the first page by typing in the url. I have it coded at top to redirect to another page in the session variable is null...but since it is not null, the can get to the page.

Is there anyway to tell how a person got to the page...for instance IF previous url <> "login.asp" then redirect to login.asp.

Or does anyone have any other suggestions.

Thanks

 
use...

if instr(request.servervariables("HTTP_Referer"),"whatver")> 0 then

-DNG
 
Set up an array of page names, set a session variable with the last page visited, and check to make sure that the current page is the next page in the array ( or the same as the session variable value, if you want to allow that). If not, then redirect to the appropriate page.

Lee
 
Thanks for the help....

I ended up putting the following code in a include file

<%
Dim HTTP_Referer

HTTP_Referer=Request.ServerVariables("HTTP_Referer")

If HTTP_Referer <> "mypage" Then
Response.Redirect "index.asp"
End If
%>

Thanks again for the help
 
If HTTP_Referer <> "mypage" Then --> does this work??

dont you need to say

if instr(HTTP_Referer,"mypage")>0 then

-DNG
 
The code worked out for me....I could not get

if instr(HTTP_Referer,"mypage")>0 then

to work for me...

Thanks again for your help

 
can you tell me what output are you getting when you do:

Code:
response.write Request.ServerVariables("HTTP_Referer")

-DNG

 


I just noticed that on my testbox...windows XP with IIS 6, this does not work and it redirects to index.asp. But it is working on the Windows 2003 server with IIS 6.

Please let me know if you need anything else.

How do you add the code with the border?

Thanks
 
aumstu said:
"How do you add the code with the border?"
Click the "Process TGML" link down below the submit button to see the example of how to make a box for code and also for doing bold, itallics, and other stuff in tek-tips.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top