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

asp.net 用流的方式下载文件

//以下代码根据别人文章和自己整理
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
namespace WebApplication1
{
public partial class DownfFile : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
/// <summary>
/// WriteFile下载
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Button1_Click(object sender, EventArgs e)
{
string name ="DreamweaverCS3简体中文免激活绿色版.rar";
string path =Server.MapPath("DreamweaverCS3简体中文免激活绿色版.rar");
FileInfo fileinfo = new FileInfo(path);
long size = fileinfo.Length;
Response.Clear();
Response.ContentType = "application/octet-stream";
Response.AppendHeader("Content-Disposition", "attachment;filename=" + name);
Response.AppendHeader("Content-Length", size.ToString());
Response.AppendHeader("Content-Transfer-Encoding", "binary");
Response.ContentEncoding = System.Text.Encoding.UTF8;//GetEncoding("gb2312");
Response.WriteFile(path,0,size);
Response.Flush();
Response.End();
}
/// <summary>
/// 使用OutputStream.Write分块下载文件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

protected void Button2_Click(object sender, EventArgs e)
{
string fileName = HttpContext.Current.Server.UrlEncode("DreamweaverCS3简体中文免激活绿色版.rar");
string filePath = HttpContext.Current.Server.MapPath("DreamweaverCS3简体中文免激活绿色版.rar");
//如果要写类的话用HttpResponse h


相关文档:

Asp.Net常用的三十三种代码

1. 打开新的窗口并传送参数:
  传送参数:
response.write("<script>window.open(’*.aspx?id="+this.DropDownList1.SelectIndex+"&id1="+...+"’)</script>")
  接收参数:
string a = Request.QueryString("id");
string b = Request.QueryString("id1");
  2.为按钮添加对话框
Button1 ......

如何使用ASP.NET Profile


Asp.Net中有一套与用户相关联的属性设置,可以通过在WebConfig里配置来直接使用,他的作用为
存储和使用唯一与用户对应的信息
展现个人化版本的Web应用程序
用户的唯一身份标识在再次访问时识别用户
Asp.Net Profile提供的跟用户相关的类型都是强类型
首先生成数据库脚本,使用Visual Studio 2005 命令提示,输入 ......

ASP.NET配置文件Web.config

认识ASP.NET配置文件Web.config
  一、认识Web.config文件
  Web.config文件是一个XML文本文件,它用来储存 ASP.NET Web 应用程序的配置信息(如最常用的设置ASP.NET Web 应用程序的身份验证方式),它可以出现在应用程序的每一个目录中。当你通过VB.NET新建一个Web应用程序后,默认情况下会在根目录自动创建一个默认的 ......

asp.net 下实现文件上传进度条(IHttpModule)

本文将探讨asp.net下实现文件上穿进度条的方法。
一般情况下,要实现上传进度条首先要实现上传文件分块读取,而默认情况下,iis将直接把上传的文件一次读入到内存中,所以本处的难点在于拦截iis的文件上传过程,转而自己的实现方式。所以,我们可以实现一个IHttpModule来处理上传过程。具体的过程是Application_BeginReque ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号