zoukankan      html  css  js  c++  java
  • .net 网站首页,本次的项目中用到的一个网站首页中统计网页访问量的工具方法,我觉得它应该在pagebase里面,拿来用一下

    需要建立一个根文件夹 ~/xml/couter.txt

    #region 网站访问量         protected void pageviews() {             int count = 0;             //数据累加             int Stat = 0;             StreamReader srd;             //取得文件的实际路径             string file_path = Server.MapPath("/XML/counter.txt");             //打开文件进行读取             srd = File.OpenText(file_path);             while (srd.Peek() != -1) {                 string str = srd.ReadLine();                 count = int.Parse(str);             }             srd.Close();             // 在新会话启动时运行的代码             Application.Lock();             //获取Application对象中保存的网站总访问量             Stat = count;             Stat += 1;             object obj = Stat;             Application["counter"] = obj;             //将数据记录写入文件             StreamWriter srw = new StreamWriter(file_path, false);             srw.WriteLine(Stat);             srw.Close();             Application.UnLock();         }         #endregion
  • 相关阅读:
    spring mvc常用配置
    spring data redis使用1——连接的创建
    spring session使用小记
    log4j2使用入门(一)
    com.google.common.eventbus.EventBus介绍
    使用java远程调试技术监控代码运行
    阿里云数加平台——数据同步任务调度及管理
    阿里云数加平台——BI报表使用概述和总结
    解决因block的损坏而导致hdfs启动后进入安全模式
    iOS 6 自动布局入门
  • 原文地址:https://www.cnblogs.com/hualiu0/p/4521435.html
Copyright © 2011-2022 走看看