Business source code popular download www.html.org.cn
Starting the background thread can use the following sentence:Checkonline online = new checkonline ();
Users can put it on Global. In ASAX, I have no more, and I only put it in an ASPX file for a simple test. as follows
//start.aspx
< %@page Language = C# AutoeEventwireup = True Debug = True %>
< %@ assembly name = soholife %>
<%@Import namespace = systemm%>
<%@Import namespace = soholife%>
<%@Import namespace = System.Collections%>
<script runat = Server Language = C#>
void page_load (Object Sender, EventArgs ARGS)
{{
Checkonline online = new checkonline ();
}
</script>
<html> <head>
<Style Type = Text/CSS>
td {font-size: 12;}
.bgcolor {background: #ffffcc;}
</style>
</head>
<body> <CENTER>
</center> </body> </html>
And we also need a program to display the data that is currently supported online. The program is as follows:
//online.aspx
< %@page Language = C# AutoeEventwireup = True Debug = True %>
< %@ assembly name = soholife %>
<%@Import namespace = systemm%>
<%@Import namespace = soholife%>
<%@Import namespace = System.Collections%>
<script runat = Server Language = C#>
void page_load (Object Sender, EventArgs ARGS)
{{
onlineUser Temp = new onlineUSER ();
arraylist allUser = Temp.alluser;
string str =;
str += <trbgcolor =#ffff99>;
str += <td width = 100 align = center class = coolbar> user </td>;
str += <td align = center width = 150 class = coolbar> Login time </td>
str += <td align = center width = 150 class = coolbar> Recent time </td>;
str += <td width = 100 height = 20 class = coolbar> Current position </td>;
str += </tr>;
for (int i = 0; I <all .count; i ++)
{{
soholife.user tester = (soholife.user) alluser [i];
str += <trbgcolor = white>;
str + = <td> + tempuser.name + </td>;
str + = <td> + tempuser.lasttime + </td>;
str + = <td> + tempuser.curtime + </td>;
str + = <td> + tempuser.iswhere + </td>;
str += </tr>;
}
maininfo.text = str;
}
</script>
<html> <head>
<Style Type = Text/CSS>
td {font-size: 12;}
.bgcolor {background: #ffffcc;}
</style>
<script language = javascript>
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;
}
</script>
</head>
<body BGCOLOR =#ccffcc> <Enter>
<br>
<Table width = 450 bgcolor = White cellpadding = 0 cellspacing = 0 style = border: none;>>
<tr> <td colorpan = 2 align = center class = bar> Current online user </td> </tr>
</table> <br>
<asp: label font-size = 8pt id = showmsg runat = server/>
<Table width = 450 BGCOLOR = White Cellpadding = 2 Cellspacing = 1 Class = Grid>
<asp: label font-size = 8pt ID = Maininfo Runat = Server/>
</table>
</center> </body> </html>