session

xiaoxiao2021-03-06  65

A few days ago, someone asked the question in session_onend, and now answers the following:

In the session_onend in Global.asa, you cannot use Session ("XXX") to access the upcoming session variable, but can read the value of the variable with the Contents collection method.

E.g:

In Default. 3 session variables in ASP

....

Session ("pass") = TRUE

Session ("ID") = RS ("ID")

Session ("User" = RS ("Name")

.......

At this point in Global. If used in ASA

SUB session_onend

IF session ("pass") THEN

Application ("Online") = Application ("Online") - 1

END IF

End Sub

The program does not execute the content in the THEN, but if you change to Contents, you can

SUB session_onend

IF session.contents (1) THEN

Application ("Online") = Application ("Online") - 1

END IF

End Sub

In this example

Session.Contents (1) = TRUE

Session.contents (2) = RS ("ID") value

Session.Contents (3) = RS ("User")

Contents can be understood as an array that loads the value of all session variables, please note the order of the variables and the subscript in the array.

转载请注明原文地址:https://www.9cbs.com/read-89957.html

New Post(0)