zoukankan      html  css  js  c++  java
  • 静态页面统计

    原创 静态页面浏览数统计 for asp.net收藏

    1在静态页面加入 <script src="../user/count.aspx?id=6"></script>  
    <DIV id=ny_detailmain_tit02><FONT color=#00000>作者:</FONT>杨彩 <FONT color=#00000>出处:</FONT> <FONT color=#00000>时间:</FONT>  <FONT color=#00000>阅读次数:<script src="../user/count.aspx?id=6"></script></FONT>
     
    </DIV>

    2.建立.net页面 count.aspx   首先把count.aspx页面里面的代码除第一行 <%@ Page Language="C#" AutoEventWireup="true" CodeFile="count.aspx.cs" Inherits="user_count" %> 外,其它全部都删掉

    count.aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="count.aspx.cs" Inherits="user_count" %>

    count.aspx.cs

    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;

    public partial class user_count : System.Web.UI.Page
    {
        
    protected void Page_Load(object sender, EventArgs e)
        {
            
    string id = Request.QueryString["id"];
            
    if (id != null)
            {
                DB manager 
    = new DB();
                
    string num = manager.oneNumber("select aReadTime from article where aID=" + id);  //读阅读数
                manager.insertdata("update article set aReadTime=aReadTime+1 where aID=" + id);   //阅读数加1
                manager.close();
                Response.Write(
    "document.write('" + num + "');");
            }
            
    else
            {
                Response.Write(
    "document.write('null');");
            }

            
        }
    }
  • 相关阅读:
    [BZOJ2431] [HAOI2009]逆序对数列
    [Luogu2323] [HNOI2006]公路修建问题
    [Luogu2455] [SDOI2006]线性方程组
    [BZOJ3550] [Sdoi2014]数数
    [Noip2017] 列队
    [Luogu2824] [HEOI2016/TJOI2016]排序
    [BZOJ1060] [ZJOI2007]时态同步
    P1036 选数 题解
    快速幂取模算法详解
    同余定理及其应用
  • 原文地址:https://www.cnblogs.com/hqbird/p/1408238.html
Copyright © 2011-2022 走看看