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

Hit Counter and Visitor Online of ASP.NET docx

3 153 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

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 Counter(string sPath) { sCounterPage=sPath; } public int ReadFile() { StreamReader objStreamReader; objStreamReader=File.OpenText(sCounterPage); sCounter=objStreamReader.ReadToEnd(); iCounter=(int)(sCounter); iCounter +=1; 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) { 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; } . 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;. objStreamReader=File.OpenText(sCounterPage); sCounter=objStreamReader.ReadToEnd(); iCounter=(int)(sCounter); iCounter +=1; objStreamReader.Close(); Return iCounter; } public void WriteFile(). objStreamWrite=File.CreateText(sCounterPage); objStreamWrite.Write(iCounter.ToString()); objStreamWrite.Close(); } } Visitor Online Sub Application_OnStart(Object sender, EventArgs e) { Application["VistorOnline"]=0;

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

TỪ KHÓA LIÊN QUAN