Asp.Net文件下载
文件下载
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //下载当前路径下的 QQ截图20160720184811.png, 如果文件名不Encode的话,IE下载会文件名乱码 string encodeFileName = context.Server.UrlEncode("QQ截图20160720184811.png"); context.Response.AddHeader("Content-Disposition", $"attachment;filename=\"{encodeFileName}\""); context.Response.WriteFile("QQ截图20160720184811.png"); }
浙公网安备 33010602011771号