国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > ASP > 正文

在ASP應用中驗證用戶身份(5)

2019-11-18 22:18:59
字體:
來源:轉載
供稿:網友
五、會話終止

   當asp會話結束時會運行global.asa中的session_OnEnd方法,可以在這里刪除
保存在application("Users")數組中由于超時而被終止會話的用戶。記錄用戶是由
于什么原因(超時還是顯式退出)終止會話往往很有用處,下面的代碼通過更新Users
表的TimedOut字段實現該功能:
sub Session_OnEnd
dim AppUsers
dim aUser
dim I
dim j
dim conn
dim supportsCookies
dim foundUser
on error resume next
supportsCookies=Session("SupportsCookies")
Application.Lock
AppUsers = Application("Users")
foundUser = false
for I = 0 to ubound(AppUsers)
set aUser = AppUsers(I)
if supportsCookies then
if aUser("SessionID") = Session.SessionID then
foundUser = true
end if
elseif dateAdd("n", Session.timeout, aUser("LastActivity")) < now()
then
foundUser = true
end if
if foundUser then
set conn = server.createObject("ADODB.Connection")
conn.ConnectionString=Session("ConnectionString")
conn.ConnectionTimeout=Session("ConnectionTimeout")
conn.mode=Session("Mode")
conn.open
conn.execute "UPDATE Users SET TimedOut=1 WHERE Users.Signon='" &
aUser("Signon") & "'"
conn.close
set conn=nothing
set aUser=nothing
set AppUsers(I) = nothing
for j = I to ubound(AppUsers) - 1
set AppUsers(j) = AppUsers(j + 1)
next
if ubound(AppUsers) > 0 then
redim PReserve AppUsers(ubound(AppUsers) - 1)
else
AppUsers = Array()
end if
exit for
end if
next
Application("Users") = AppUsers
Application.UnLock
end sub


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表

圖片精選

主站蜘蛛池模板: 阳曲县| 全州县| 剑阁县| 绥化市| 衡水市| 伊吾县| 彰武县| 池州市| 内乡县| 弋阳县| 永城市| 河南省| 孟州市| 德阳市| 陇川县| 鹤壁市| 太湖县| 江城| 嘉鱼县| 云龙县| 六安市| 武冈市| 洛川县| 平湖市| 青海省| 舒兰市| 贵阳市| 射洪县| 贵港市| 东光县| 松阳县| 化隆| 易门县| 中山市| 辰溪县| 宁津县| 景谷| 汉中市| 安康市| 新津县| 宁乡县|