...

Restrict Resfresh Option

irfan_haider
08-19-2002, 09:03 AM
Dear friends
I have two questions

1) How can we restrict refresh option? I donot want that when page is displayed some one can refresh it. As i do insertion there. Primary key is inserted automatically by getting max number and incremented by 1. so by refreshing the insertion is done again.

2) Before using the Response.redirect i want to give pause for 10 seconds. How can I do that.
Thanks

raf
08-19-2002, 02:04 PM
about your first question :
- one way to dot it is work with a session variable (say update), that innitially is set to "0" (for exapmle in your global.asa) and that is set to "1" after the insertion. for example after running a verification like

dim inserted 'variable used as parameter in following statement
conTest.Execute sql,inserted
if inserted >=1 then
update=1
end if

and in the top of your body you enter a verification like


if update=1 then
response.write("You can't refresh this page blablabla")
else
....
end if

so if a user then refreshes the page, he will onlu get this mesage
when he goes to another 'asp) page, you can set the update-variable back to "0" an reuse this variable for other insert-pages

- another way is to rederict if update=1
about your second question :

it depends whether you want to do this on the userside or the serversite. i think it's best to do this on the users side, so you can show a "waiting" text. if so, use the javascript "onload" function.

irfan_haider
08-20-2002, 07:14 AM
DEAR RAF
DO YOU KKNOW JAVASCRIPT FUNCTION WHICH SHOW A MESSAGE WAIT FOE SOME SECONG AND THEN REDIRECT.

raf
08-20-2002, 07:54 AM
you find one at this url

http://javascriptkit.com/script/cut168.shtml

it looks nice, with an extra feature (timecountdown in the status bar) url contains source + instructions to modify and insert into your page.

oh yeah : the "message" is then your html page where you insert this script in.

whammy
08-21-2002, 06:43 PM
http://www.askasp.com/articles.asp?ArtID=85

<%
' Get Start Time
StartTime = Timer()

'Get End Time
EndTime = Timer()

'Determine how long it took
WaitTime = EndTime - StartTime

'Continue checking the elapsed time until it reaches 10 seconds
do while WaitTime < 10
'Get End Time
EndTime = Timer()

'Determine how long it took
WaitTime = EndTime - StartTime
loop

'Redirect user, since we know that it has been more than 10 seconds
Response.Redirect "page2.asp"
%>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum