<%@ WebHandler Language="C#" Class="_05_download" %> using System; using System.Web; public class _05_download : IHttpHandler { public void ProcessRequest (HttpContext context) { context.Response.ContentType = "text/plain"; string url = context.Request.QueryString["url"]; //解决 中文名乱码的问题 string name = HttpUtility.UrlEncode(url); context.Response.AddHeader("Content-Disposition", "attachment;filename=" + name); string path = context.Request.MapPath(url); context.Response.WriteFile(path); } public bool IsReusable { get { return false; } } }