启动后台线程可以用下面的语句:
CheckOnline online=new CheckOnline();
用户可以将它放到GLOBAL。ASAX中,我是没有了,只放到了一个ASPX文件中做简单的测试。如下
//start.aspx
<%@ Page Language="c#" autoEventWireup=true Debug="true" %>
<%@ Assembly Name="Soholife" %>
<%@Import Namespace="System"%>
<%@Import Namespace="Soholife"%>
<%@Import Namespace="System.Collections"%>
void Page_Load(Object sender, EventArgs args)
{
CheckOnline online=new CheckOnline();
}
td{font-size:12;}
.bgcolor{background:#ffffcc;}
而我们还需要一个程序来显示当前在线拥护的数据,程序如下:
//online.aspx
<%@ Page Language="c#" autoEventWireup=true Debug="true" %>
<%@ Assembly Name="Soholife" %>
<%@Import Namespace="System"%>
<%@Import Namespace="Soholife"%>
<%@Import Namespace="System.Collections"%>
void Page_Load(Object sender, EventArgs args)
{
OnLineUser temp= new OnLineUser();
ArrayList alluser =temp.alluser;
string str="";
str += "
str += "
str += "
str += "
str += "
str += "
for ( int i = 0 ; i < alluser.Count ; i++)
{
Soholife.User tempuser=(Soholife.User)alluser[i] ;
str += "
str += "
str += "
str += "
str += "
str += "
}
maininfo.Text=str;
}
td{font-size:12;}
.bgcolor{background:#ffffcc;}
function openwindow(url,w,h)
{
window.open(url,"","toolbar=no,menubar=no,directories=no,status=yes,width=" + w + ",height=" + h + ",scrollbars=yes,resizable=yes");
return false;
}
| 当前在线用户 |

