易截截图软件、单文件、免安装、纯绿色、仅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.Length.ToString());
      &


相关文档:

如何在Asp.net使用模式对话框提交而不打开新窗口?

在项目中我要用到修改密码功能,修改密码页我是用模式对话框的形式弹出来的,当我按正常情况提交数据时,发现它会弹出一个新的窗口来显示修改成功信息,我想提交数据而不打开新窗口,
我的解决办法就是在head标签中加上base标签让target="_self",之前我想得有点复杂,想给它一个固定的alert,当成功修改时才显示 ......

ASP.NET关闭当前窗口同时打开一个新窗口

首先,在pageload里写入以下代码:Response.Write("<script>window.opener=null;window.close();</script>");
其次,在head里写下如下JS代码: <script language="JavaScript">
<!--
function openwin() { window.open ("Default.aspx", "newwindow", "height=600, width=600, toolbar=no, menubar=n ......

一个简单的ASP.NET +ACCESS 登录

首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号