易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.Net中的几种文件下载方法

//TransmitFile实现下载
    protected void Button1_Click(object sender, EventArgs e)
    {
        /*
         微软为Response对象提供了一个新的方法TransmitFile来解决使用Response.BinaryWrite
         下载超过400mb的文件时导致Aspnet_wp.exe进程回收而无法成功下载的问题。
         代码如下:
         */
        Response.ContentType = "application/x-zip-compressed";
        Response.AddHeader("Content-Disposition", "attachment;filename=z.zip");
        string filename = Server.MapPath("DownLoad/z.zip");
        Response.TransmitFile(filename);
    }
    //WriteFile实现下载
    protected void Button2_Click(object sender, EventArgs e)
    {
        /*
         using System.IO;
        
         */
        string fileName = "asd.txt";//客户端保存的文件名
        string filePath = Server.MapPath("DownLoad/aaa.txt");//路径
        FileInfo fileInfo = new FileInfo(filePath);
        Response.Clear();
        Response.ClearContent();
        Response.ClearHeaders();
        Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
        Response.AddHeader("Content-Length", fileInfo.Lengt


相关文档:

c#(asp.net)几中不同从前台页面操作后台

第一种
<%=RetInfo("DB","数据库") %>
<%=RetInfo("YX_UpFile","上传文件") %>
<%=RetfileInfo("Include/", "广告")%>
//从前台调用后台方法
//从前台调用后台的方法..并向其方法传入不同的参数!
第二种
<ItemTemplate >
<%#Ret_stat(Convert.ToInt16(Eval("YX_Stat1")), "热点")%> ......

处理有返回值的和return的asp.net写法

 SqlConnection   conPortal   =   new   SqlConnection(CommunityGlobals.ConnectionString);  
                          SqlCommand   cmdAdd   =   new   SqlCommand(   "Community_Disc ......

asp.net进度条

一、原理:
      要实现进度条的实时反映,核心的技术就是对上传的数据进行“分块”读取,在读取每块数据时记录当前已上传的块数,根据
分块的大小,即可知道已上传的大小,根据总大小,即可知道当前上传的进度。具体的技术还是利用隐含的HttpWorkerRequest
,用它的GetPreloadedEn ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号