易截截图软件、单文件、免安装、纯绿色、仅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中显示在线用户


asp.net中显示在线用户
private static System.Threading.Timer timer;
private const int interval = 1000 * 60 * 20;//检查在线用户的间隔时间
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
public Global()
{
Initialize ......

ASP.NET文件上传,为每个用户建立一个上传目录

文件上传界面既可以用Html的input file控件,又可以用FileUpload控件,只要将Html的input file控件加上runat="server",就会发现两者的功能完全是一模一样,上传的代码是共用的,不需要做任何改变。我想微软在将Html控件将成标准控件时应该只是多加了runat="server"吧。放入上述两者的任一控件后,添加一个标准的Button按钮 ......

Tip/Trick: Url Rewriting with ASP.NET

 
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications.  This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have th ......

ASP.NET FileUpload应用实例

Default.aspx:
<%@ 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" ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号