日期:2014-05-18  浏览次数:20463 次

求ASP.NET(VB)当前在线人数源代码
写了一个函数统计在线人数,总是出错。求一个正确的函数源代码,请高手们帮忙,让我参考你们正确的代码,急用,谢谢!

------解决方案--------------------
不会也要坐沙发
------解决方案--------------------
Global.asax 文件
------------

<script language= "vb " runat= "server ">
sub application_start(S As Object, E As EventArgs)
Application( "counter ")=0
end sub
sub session_start(S As Object, E As EventArgs)
Session( "On_Line ")=False
end sub
</script>



*.aspx 文件
-----------

<script language= "VB " runat= "server ">
function webcounter() as long
if not session( "on_line ") then
application.Lock()
application( "counter ")=application( "counter ")+1
application.UnLock()
session( "on_line ")= true
end if
webcounter=application( "counter ")
end function
</script>

<html>
<head>
<title> count </title>
<meta http-equiv= "Content-Type " content= "text/html; charset=gb2312 ">
</head>
<body>

<h2> 您是第 <font color= "blue "〉 <%= WebCounter %> </font> 位访客! </h2>


</body>
</html>

------解决方案--------------------
这是访问量 不是统计在线人数
你先要拿个东西 纪录登陆了的人员信息 临时表或其他什么东西