TestCode

博客园 首页 新随笔 联系 订阅 管理

Handler.ashx:生成动态Excel文件

public class Handler : IHttpHandler {
    public void ProcessRequest (HttpContext context) {
        context.Response.ContentType = "application/octet-stream";
        string filename = HttpUtility.UrlEncode("动态生成.xls");
        context.Response.AddHeader("Content-disposition",string.Format("attachment:filename={0}",filename));

       //谁能帮我解释一下上面加粗的这句代码,功能我知道,但需要详细一点的解释,先谢谢哈

    }
    public bool IsReusable {
        get {
            return false;
        }
    }
}

posted on 2011-06-25 21:25  yaoguipeng  阅读(676)  评论(2编辑  收藏  举报