www.webdeveloper.com
Results 1 to 4 of 4

Thread: execute code only once

Hybrid View

  1. #1
    Join Date
    Feb 2007
    Posts
    2

    execute code only once

    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

  2. #2
    Join Date
    Nov 2002
    Posts
    4,473
    Set a session variable that will indicate that the code doesn't need to run again, or a cookie on the client.

  3. #3
    Join Date
    Feb 2007
    Posts
    2
    Can you post code example how to do that? I am new to ASP.

  4. #4
    Join Date
    Nov 2002
    Posts
    4,473
    Pretty basic
    Code:
    <% if session("alreadyRan") = "" then
    ' do your code
      session("alreadyRan") = "true"
    else
    ' don't do your code
    end if %>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles