我想找一个下载的代码。

解决方案 »

  1.   

    http://www.cnblogs.com/wj-wangjun/archive/2009/01/01/1366624.html
      

  2.   

    http://www.cnblogs.com/liping13599168/archive/2009/02/08/672025.htmlhttp://hi.baidu.com/%B0%AE%BF%DE%CD%EB/blog/item/ae9c0f7be519f6f20ad18746.html
      

  3.   


    protected void Button1_Click(object sender, EventArgs e)
        {
            //例如要下载App_Data目录下的excel文件:"excelFile.xls"
            string strFileName = "excelFile";
            string strFilePath = System.Web.HttpContext.Current.Server.MapPath("./App_Data/") + strFileName + ".xls";
            System.IO.FileInfo file = new System.IO.FileInfo(strFilePath);        Response.Clear();
            Response.AddHeader("Content-Disposition", "attachment;   filename=" + HttpUtility.UrlEncode(strFileName + ".xls"));
            Response.AddHeader("Content-Length", file.Length.ToString());
            Response.ContentType = "application/octet-stream";
            Response.WriteFile(file.FullName);
            Response.Flush();
            Response.Clear();
            Response.End();
        }在页面添加一个按钮Button1,上面为后台Button1的点击事件中代码
      

  4.   

    http://download.csdn.net/source/1200614
      完全开源.. 整个流程都在里面..
       包括项目文档. 一个B2C (企业对客户的) 项目..
     保证看的懂