1、点击下载按钮同时会弹出IE下载框和迅雷下载有没有办法只让他弹出一种?2、发觉迅雷每打开一个线程Page_Load都会执行一次有没有办法让他只执行一次?

解决方案 »

  1.   

    private void Page_Load(object sender, EventArgs e)
            {
                
                string SqlString = "UPDATE Topic SET Clicks=(Clicks+1) WHERE ID=" + this.topicID.ToString() + "; SELECT Subject,Referencer,Money FROM Topic WHERE ID=" + this.topicID.ToString() + ";";
                string subject = null, referencer = null;
                int payCount = 0;            using (SqlConnection Conn = new SqlConnection(ConfigurationManager.AppSettings["DbLink"]))
                {
                    Conn.Open();
                    SqlDataReader SDR;
                    SqlCommand Comm = new SqlCommand();
                    Comm.Connection = Conn;
                    Comm.CommandType = CommandType.Text;
                    Comm.CommandText = SqlString;
                    SDR = Comm.ExecuteReader();
                    if (SDR.Read())
                    {
                        subject = SDR[0].ToString();
                        referencer = SDR[1].ToString();
                        payCount = (int)SDR[2];
                    }
                    SDR.Close();
                    Comm.Dispose();
                    Conn.Close();
                }            referencer = Server.MapPath(referencer);
                System.IO.FileInfo FI = new System.IO.FileInfo(referencer);            if (!FI.Exists)
                {
                   Response.Write("对不起!没有找到可下载的文件。" );            
                }
                else
                {
                    Response.Clear();
                    Response.ContentType = "application/octet-stream";                Response.AddHeader("Content-Type", "application/octet-stream");
                    Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlPathEncode(subject) + FI.Extension);
                    Response.AddHeader("Content-Length", FI.Length.ToString());                Response.Flush();
                    Response.TransmitFile(referencer);
                    Response.End();
                }
            }迅雷线程数5,下载的时候就会更新5次,同时会打开一个IE下载,Update六次,有没有办法让他只更新一次?
      

  2.   

    跟你的程序没有关系。多线程、断点续传的程序说不定会访问你的aspx 200次才下载成功一个文件,这很正常(如果你知道是什么原理的话)。一个aspx不可能控制会多少请求到来。你唯一可以做的,就是在检测到同一时间(或者很短时间内)同一ip重复访问的时候,直接返回异常,让多线程失败。