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
相关文档:
1、ASP.NET中的AJAX应用开发总结
http://blog.csdn.net/zhoufoxcn/archive/2009/12/07/4954645.aspx
2、用自定义IHttpModule实现URL重写
http://blog.csdn.net/zhoufoxcn/archive/2009/07/14/4346356.aspx
3、把C#中方法重载说透
http://blog.csdn.net/zhoufoxcn/archive/2008/09/09/2902078.aspx
4、.net 实现 URL重 ......
11月21日晚7点应邀在武汉大学信息学院做了一场关于ASP.NET下AJAX开发的报告,以我自己经历讲述了一些特殊应用在过去到现在实现手段的变化,本来想回家之后做个总结的,但是由于最近以来事情一直很多,所以没有来得及总结。今晚得以有空总结一下。
AJAX介绍
其实AJAX应用的核 ......
前台代码:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="articleview.aspx.cs" Inherits="articleview" %>
<!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"> ......
SqlConnection conPortal = new SqlConnection(CommunityGlobals.ConnectionString);
SqlCommand cmdAdd = new SqlCommand( "Community_Disc ......
之前写过一系列的ExtJS的使用教程,但是基本比较零散,本文主要对其进行归纳总结。希望对于初学或者复习extjs的同盟们有所帮助。
列表清单如下所示:
1、ExtJS的使用方法汇总(1)——配置和表格控件使用 :
http://blog.csdn.net/rocket5725/archive/2009/09/09/4535323.aspx
2、ExtJS的使用方法汇总(2)&mdash ......