title: ASP.NET Response.End Problem
body: <p>i got a page users downloading files from there.And when a user click download link and finish downloading file , i am insertin' a new record for my File Download Counter event. (FileID,Date,blalbla..) </p>
  
  <p>But there is problem with my script ... after download starts and finish, its adding a new record but after this, its fires event again and making a new record too.So 1 download and 2 new download record. here is my script; </p>
  
  <pre><code> if (Page.Request.QueryString["FileID"] != null)
          {
              OleDbCommand command = new OleDbCommand("select * from Dosyalar where DosyaID=" + Page.Request.QueryString["FileID"].ToString(), veri.baglan());
  
              string dosyaAdi = "";
              int DosyaID = 0;
              OleDbDataReader dr = command.ExecuteReader();
              while (dr.Read())
              {
  
                  dosyaAdi = Server.MapPath("formlar") + "\\" + dr["URL"].ToString();
                  DosyaID = Convert.ToInt32(dr["FileID"]);
  
              }
              dr.Close();
  
              FileInfo dosya = new FileInfo(dosyaAdi);
              Response.Clear();
              Response.AddHeader("Content-Disposition", "attachment; filename=" + dosya.Name);
              Response.AddHeader("Content-Length", dosya.Length.ToString());
              Response.ContentType = "application/octet-stream";
              Response.WriteFile(dosyaAdi);
             // INSERT A NEW RECORD 
              OleDbCommand ekle = new OleDbCommand("Insert into Indirilenler (FileID,Tarih) values (@p1,@p2)", veri.baglan());
              ekle.Parameters.AddWithValue("p1", FileID);
              ekle.Parameters.AddWithValue("p2", DateTime.Now.ToShortDateString());
              ekle.ExecuteNonQuery();
              Response.Flush();
              Response.End();
  </code></pre>