Click to See Complete Forum and Search --> : execute code only once


Tomazaz
02-15-2007, 10:50 AM
Hello,

I have ASP web page with ASP code inside which I need to execute only once when user visit page, if he/she press refresh code should be ignored. How to do that?

Regards,
Tomas

gil davis
02-15-2007, 11:14 AM
Set a session variable that will indicate that the code doesn't need to run again, or a cookie on the client.

Tomazaz
02-15-2007, 11:25 AM
Can you post code example how to do that? I am new to ASP.

gil davis
02-15-2007, 12:22 PM
Pretty basic
<% if session("alreadyRan") = "" then
' do your code
session("alreadyRan") = "true"
else
' don't do your code
end if %>