Using System;
Using System. Collections;
Using System. Configuration;
Using System. Data;
Using System. Web;
Using System. Web. Security;
Using System. Web. SessionState;
Namespace OnlineUser
{
Public class Global: System. Web. HttpApplication
{
Protected void Application_Start (object sender, EventArgs e)
{
# Region OnlineUsers
Try
{
DataTable userTable = new DataTable ();
UserTable. Columns. Add ("SessionID ");
UserTable. Columns. Add ("UserIP ");
UserTable. Columns. Add ("Browser ");
UserTable. Columns. Add ("OSName ");
UserTable. AcceptChanges ();
Application. Lock ();
Application ["OnlineUsers"] = userTable;
Application. UnLock ();
}
Catch
{}
# Endregion
}
Protected void Session_Start (object sender, EventArgs e)
{
// Cookie is used to prevent repeated counting by the same user
HttpCookie cookie = Request. Cookies ["user"];
If (null = cookie) // determine whether the cookie entered by the user exists
{
Cookie = new HttpCookie ("user"); // create a cookie object named "user"
Cookie. Value = "used"; // Value assigned to the cookie. It can only be a string and must be converted instead of a string.
Cookie. Expires = DateTime. Now. AddHou