[code]void Application_Start(Object sender,EventArgs e) 
{int count=0;System.IO.StreamReader srd;//获取文件的实际路径string file_path=Server.MapPath("counter.txt");srd=System.IO.FileText(file_path);while(srd.Peek()!=-1){string str=srd.ReadLIne();count=int.Parse(str);}srd.Close();object obj=count;Application["counter"]=obj;}void Session_Stat(Object sender,EventArgs e){Application.Lock();int Stat=0;Stat=(int)Application["counter"];Stat+=1;object obj=Stat;Application["counter"]=obj;//将数据写入文件string file_path=Server.MapPath("count.txt");System.IO.StreamWriter srw=new System.IO.StreamWriter(file_path);srw.WriteLine(Stat);srw.Close();Application.UnLock();}void Application_End(object sender,EventArgs){int Stat=0;Stat=(int)Application["counter"];System.IO.StreamWriter srw=new System.IO.StreamWriter();srw.WriteLine(Stat);srw.Close();}[/code]你也可以选择将登陆计数写在数据库里,如果只是为了实现查看,你就可以引用 现成的统计插件