1. Trang chủ
  2. » Giáo Dục - Đào Tạo

Hit Counter and Visitor Online of ASP.NET docx

3 155 0

Đang tải... (xem toàn văn)

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 3
Dung lượng 6,92 KB

Các công cụ chuyển đổi và chỉnh sửa cho tài liệu này

Nội dung

Hit Counter and Visitor Online of ASP.NET Hit Counter class Counter { private string sCounterPage; private string sCounter; private int iCounter; public Counterstring sPath { sCounterPag

Trang 1

Hit Counter and Visitor Online of ASP.NET

Hit Counter

class Counter

{

private string sCounterPage;

private string sCounter;

private int iCounter;

public Counter(string sPath)

{

sCounterPage=sPath;

}

public int ReadFile()

{

StreamReader objStreamReader;

objStreamReader=File.OpenText(sCounterPage);

sCounter=objStreamReader.ReadToEnd();

iCounter=(int)(sCounter);

iCounter +=1;

Trang 2

objStreamReader.Close();

Return iCounter;

}

public void WriteFile()

{

StreamWrite objStreamWrite;

objStreamWrite=File.CreateText(sCounterPage); objStreamWrite.Write(iCounter.ToString());

objStreamWrite.Close();

}

}

Visitor Online

Sub Application_OnStart(Object sender, EventArgs e) {

Application["VistorOnline"]=0;

}

Sub Sessioin_OnStart(Object sender, EventArgs e)

Trang 3

{

Session.TimeOut=

Application.Lock;

Application["VisitorOnline"]=Application + 1; Application.UnLock;

}

Sub Session_OnEnd(Object sender, EventArgs e) {

Application.Lock;

Application["VisitorOnline"]=Application - 1; Application.UnLock;

}

Ngày đăng: 13/08/2014, 11:20

TỪ KHÓA LIÊN QUAN

🧩 Sản phẩm bạn có thể quan tâm