asp.net文件下载
//TransmitFile实现下载
protected void Button1_Click1(object sender, EventArgs e)
{
/*
微软为Response对象提供了一个新的方法TransmitFile来解决使用Response.BinaryWrite
下载超过400mb的文件时导致Aspnet_wp.exe进程回收而无法成功下载的问题。
代码如下:
*/
string strFileName = "三部闲置设备管理系统操作手册IEMS.ppt";
Response.ContentType = "application/x-zip-compressed";
//Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312");
string filename = BLL.Config.PART_EM_UPLOAD_DOC + strFileName;
//BLL.Config.PART_EM_UPLOAD_DOC 为路径 ("D:/EMUploadDoc/")
Response.AddHeader("Content-Disposition", "attachment;filename=" +Server.UrlPathEncode(strFileName));
//Server.UrlPathEncode()解决文件名的乱码问题.
Response.TransmitFile(filename);
} //WriteFile实现下载
protected void Button2_Click(object sender, EventArgs e)
&
相关文档:
///C#中的媒体播放类
using System;
namespace ConfigTools
{
/// <summary>
/// PlayClass 的摘要说明。
///原作CSDN,经本人稍加修改
/// </summary>
public class PlayClass
{
public PlayClass()
{
......
在一个
route
中,通过在大括号中放一个占位符来定义
(
{ and } )
。当解析
URL
的时候,符号
"/"
和
"."
被作为一个定义符来解析,而定义符之间的值则匹配到占位
符中。
route
定义中不在大括号中的信息则作为常量值。
下面是一些示例
URL
:
Valid route definitions
Example ......
本系列文章基于ASP.NET MVC Preview5.
view在MVC模式中与用户进行最直接的接触,它负责数据的呈现。这里要注意一点就是,view只是负责数据的呈现,所以我们应该要尽量让
view中不涉及业务逻辑的处理。
我们来添加一个Blog首页的view。在安装了ASP.NET MVC后,我们在添加新项目的时候可以看到有MVC的view模板:
......
StringWriter sw = new StringWriter();
sw.WriteLine("访问购买率");
&nbs ......