下载文件

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);

posted on   木屐  阅读(85)  评论(0编辑  收藏  举报

努力加载评论中...

导航

点击右上角即可分享
微信分享提示