这个要在js判断了  return false 不计算 return true 计算 (不知道对不对) 请告诉解答

解决方案 »

  1.   

    在button里加个aplication吗,或者在一个表中加个字段,每次点击了button时就更新字段啊
      

  2.   

    public class DownloadHandler : IHttpHandler
    {
        public void ProcessRequest(HttpContext context)
        {
            string fileName = context.Request.QueryString["filename"].ToString();
            string filePath = "path of the file on disk"; //you know where your files are
            FileInfo file = new System.IO.FileInfo(filePath);
            if (file.Exists)
            {
                try
                {
                    //更新数据库中的下载次数
                }
                catch (Exception)
                {
                    //handl.
                }
                //return the file
                context.Response.Clear();
                context.Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
                context.Response.AddHeader("Content-Length", file.Length.ToString());
                context.Response.ContentType = "application/octet-stream";
                context.Response.WriteFile(file.FullName);
                context.ApplicationInstance.CompleteRequest();
                context.Response.End();
            }
        }
        public bool IsReusable
        {
            get { return true; }
        }
    }Web.config
    <httpHandlers>
        <add verb="GET" path="FileDownload.ashx" type="DownloadHandler"/>
    </httpHandlers> page
    <a href="FileDownload.ashx?filename=file.exe">Download file.exe</a>