下载文件

context.Response.ContentType = "text/plain";

    string filename = context.Request.QueryString["u"];

    string path = context.Request.MapPath("../images/"+filename);
    
    //解决ie中下载时候。中文文件名称乱码的问题
    filename = HttpUtility.UrlEncode(filename);
    
    context.Response.AddHeader("Content-Disposition", "attachment;filename="+filename);

    context.Response.WriteFile(path);
原文地址:https://www.cnblogs.com/poli/p/4296037.html