我的程序用IE下载是正常下载的,如果用迅雷的话下载的就会是页面文件。我的代码:
 /// <summary>
   /// (Function 文件下载)
   /// </summary>
   /// <param name="filePath">文件完整路径</param>
    private void DownFile(string filePath)
    {
        try
        {
            FileInfo info = new FileInfo(filePath);
            long fileSize = info.Length;
            Response.Clear();
            Response.ContentType = "application/octet-stream";
            Response.AppendHeader("Connection", "close");
            Response.AddHeader("Content-Disposition", "attachement;filename=" + Path.GetFileName(filePath));
            //指定文件大小
            Response.AddHeader("Content-Length", fileSize.ToString());
            Response.WriteFile(filePath, 0, fileSize);
            Response.Flush();
            Response.Close();
           
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
请大家多多帮助,谢谢。