global.asa 问题请教
实现功能是 登录后 看有多少个用户在线 session("gong_hao") 能赋值 不成功
见 下述红色 部分
<object runat="Server" scope="Application"
id="rstActiveUsers" progid="ADODB.Recordset">
</object>
<script language="VBScript" runat="Server">
Sub Application_OnStart()
Const adInteger = 3
Const adVarChar = 200
Const adDate = 7
application("gong_hao")=""
rstActiveUsers.Fields.Append "id", adInteger
rstActiveUsers.Fields.Append "ip", adVarChar, 15
rstActiveUsers.Fields.Append "browser", adVarChar, 255
rstActiveUsers.Fields.Append "started", adDate
rstActiveUsers.Open
End Sub
Sub Session_OnStart()
Session.Timeout = 20
Session("Start") = Now()
If Not rstActiveUsers.EOF Then rstActiveUsers.MoveLast
rstActiveUsers.AddNew
rstActiveUsers.Fields("id").Value = session("gong_hao")'这段代码中的 session("gong_hao")获取不到值
rstActiveUsers.Fields("ip").Value = Request.ServerVariables("REMOTE_HOST")
rstActiveUsers.Fields("browser").Value = Request.ServerVariables("HTTP_USER_AGENT")
rstActiveUsers.Fields("started").Value = Now()
rstActiveUsers.Update
End Sub
Sub Session_OnEnd()
Const adSearchForward = 1
Const adBookmarkFirst = 1
Const adAffectCurrent = 1
rstActiveUsers.Find "id = " & Session.SessionID,0, adSearchForward, adBookmarkFirst
If Not rstActiveUsers.EOF Then
rstActiveUsers.Delete adAffectCurrent
End If
End Sub
</SCRIPT>