用数据库来保存点击次数: 当用户点击被下载链接时, 你做成不直接链接到被下载文件上面是用 down.asp?id=123 这种方式, 用这个页面执行累加点击次数且入库的动作, 处理完了以后再转到你真正要下载的文件上.

解决方案 »

  1.   

    // *********************************************************************************
    //                               计算点击次数
    // *********************************************************************************
    private void downLoadBtn_Click(object sender, System.EventArgs e)
    {
    if( Request.QueryString["SoftID"] != null && Request.QueryString["SoftID"] != "" )
    {
    string strUpdt = "update Soft set DownDegree=DownDegree+1 where SoftID="+Request.QueryString["SoftID"];
    SqlConnection sqlConn = new SqlConnection( ConfigurationSettings.AppSettings["ConnectString"] );
    SqlCommand sqlCmd = new SqlCommand( strUpdt, sqlConn );
    sqlConn.Open();
    sqlCmd.ExecuteNonQuery();
    sqlConn.Close(); // 将页面定向于软件所在的位置。以便下载。
    Response.Redirect(ds.Tables["Soft"].Rows[0]["DownLoadAddr"].ToString());
    }

    }
      

  2.   

    累計點數用SQL語句update Yourtable 點數=點數+1 就可以了。