Code source d'entreprise Télécharger populaire www.html.org.cn
Le démarrage du thread d'arrière-plan peut utiliser la phrase suivante:CheckOnline Online = new CheckOnline ();
Les utilisateurs peuvent le mettre sur Global. Dans Asax, je n'ai plus, et je ne l'ai mis que dans un fichier ASPX pour un test simple. comme suit
//start.aspx
<% @ Page Language = C # AutoEeventWireup = True Debug = True%>
<% @ Nom de l'assemblage = SOHOHIFE%>
<% @ Importer namespace = systemm%>
<% @ Importer namespace = soholife%>
<% @ Importer namespace = System.Collections%>
<script runat = server lingngle = c #>
void page_load (expéditeur d'objet, EventArgs args)
{{
CheckOnline Online = new CheckOnline ();
}
</cript>
<html> <adref>
<Style type = text / css>
td {taille de police: 12;}
.bgColor {Background: #ffffcc;}
</ style>
</ head>
<body> <enter>
</ Center> </ Body> </html>
Et nous avons également besoin d'un programme pour afficher les données actuellement prises en ligne.
//online.aspx
<% @ Page Language = C # AutoEeventWireup = True Debug = True%>
<% @ Nom de l'assemblage = SOHOHIFE%>
<% @ Importer namespace = systemm%>
<% @ Importer namespace = soholife%>
<% @ Importer namespace = System.Collections%>
<script runat = server lingngle = c #>
void page_load (expéditeur d'objet, EventArgs args)
{{
TEMP TEMPEUR EN LIGNEUR = NOUVEAU EN LIGNEUR ();
ArrayList alluser = temp.ALLUSER;
String str =;
str + = <trbgColor = # ffff99>;
str + = <td width = 100 align = Centre class = coolbar> utilisateur </td>;
str + = <td align = Centre width = 150 class = Coolbar> Time de connexion </td>
str + = <td align = central width = 150 class = coolbar> heure récente </td>;
str + = <td width = 100 height = 20 class = coolbar> position actuelle </td>;
str + = </tr>;
pour (int i = 0; i <tout .Count; i ++)
{{
SOHOHIFE.USER TESTER = (SOHOLIFE.USER) ALLUSER [I];
str + = <trbgColor = blanc>;
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;
}
</cript>
<html> <adref>
<Style type = text / css>
td {taille de police: 12;}
.bgColor {Background: #ffffcc;}
</ style>
<Script Language = JavaScript>
Fonction OpenWindow (URL, W, H)
{{
Window.open (URL ,, barre d'outils = non, menuBar = non, répertoires = non, status = oui, largeur = + w +, hauteur = + h +, barre de scroll = oui, reizable = oui);
Retourne false;
}
</cript>
</ head>
<corps bgcolor = # ccffcc> <Entrée>
<br>
<Largeur du tableau = 450 BGCOLOR = White CellPadding = 0 CellSpacing = 0 Style = Border: Aucun; >>
<tr> <td colorpan = 2 align = Center class = Bar> Utilisateur en ligne actuel </td> </tr>
</ table> <br>
<asp: label font-size = 8pt id = showmsg runat = server />
<Table largeur = 450 bgcolor = white cellpadding = 2 cellSpacing = 1 class = grid>
<asp: label font-size = 8pt id = maininfo runat = server />
</ table>
</ Center> </ Body> </html>