求一个ASP。NET C# 写的下载原代码。 前台后台都有的。求一个能让新手明白的。 我想找一个下载的代码。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://www.cnblogs.com/wj-wangjun/archive/2009/01/01/1366624.html http://www.cnblogs.com/liping13599168/archive/2009/02/08/672025.htmlhttp://hi.baidu.com/%B0%AE%BF%DE%CD%EB/blog/item/ae9c0f7be519f6f20ad18746.html 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的点击事件中代码 http://download.csdn.net/source/1200614 完全开源.. 整个流程都在里面.. 包括项目文档. 一个B2C (企业对客户的) 项目.. 保证看的懂 WinForm界面设计 C#多线程中for循环与while循环的奇怪问题与跨线程安全访问控件的异常? 登陆界面连接数据库的问题 java 与 c#的区别 小弟求一正则表达式 ADO.NET连接的OPEN和CLOSE该在什么时候!? (加分贴) 急求正则表达式处理字符串 我想把一个DBF文件导入SQL数据库,用C#如何实现? 关于数据过滤的问题? 请问编写传统WINDOWS程序怎样静态编译,以便在没有 。NET 系统上运行。 利用SerialPort控件怎么收短信? 怎么是金山的组件能用?
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的点击事件中代码
完全开源.. 整个流程都在里面..
包括项目文档. 一个B2C (企业对客户的) 项目..
保证看的懂