启动后台线程可以用下面的语句:
CheckOnlineonline=newCheckOnline();
用户可以将它放到GLOBAL。ASAX中,我是没有了,只放到了一个ASPX文件中做简单的测试。如下
//start.aspx
<%@PageLanguage="c#"autoEventWireup=trueDebug="true"%>
<%@AssemblyName="Soholife"%>
<%@ImportNamespace="System"%>
<%@ImportNamespace="Soholife"%>
<%@ImportNamespace="System.Collections"%>
voidPage_Load(Objectsender,EventArgsargs)
{
CheckOnlineonline=newCheckOnline();
}
td{font-size:12;}
.bgcolor{background:#ffffcc;}
而我们还需要一个程序来显示当前在线拥护的数据,程序如下:
//online.aspx
<%@PageLanguage="c#"autoEventWireup=trueDebug="true"%>
<%@AssemblyName="Soholife"%>
<%@ImportNamespace="System"%>
<%@ImportNamespace="Soholife"%>
<%@ImportNamespace="System.Collections"%>
voidPage_Load(Objectsender,EventArgsargs)
{
OnLineUsertemp=newOnLineUser();
ArrayListalluser=temp.alluser;
stringstr="";
str+="";
str+="用户";
str+="登陆时间";
str+="最近时间";
str+="当前位置";
str+="";
for(inti=0;i {
Soholife.Usertempuser=(Soholife.User)alluser[i];
str+="";
str+=""+tempuser.name+" | ";
str+=""+tempuser.lasttime+" | ";
str+=""+tempuser.curtime+" | ";
str+=""+tempuser.iswhere+" | ";
str+="";
}
maininfo.Text=str;
}
td{font-size:12;}
.bgcolor{background:#ffffcc;}
functionopenwindow(url,w,h)
{
window.open(url,"","toolbar=no,menubar=no,directories=no,status=yes,width="+w+",height="+h+",scrollbars=yes,resizable=yes");
returnfalse;
}
xml:namespace prefix = tablewidth=450bgcolor=whitecellpadding="0"cellspacing="0"style="border /