public void ProcessRequest(HttpContext context) { string PPTOutputPath = context.Request.QueryString["DownLoadFileName"]; PPTOutputPath = PPTOutputPath.Replace(",", "\\"); FileInfo PPTFileNewfile = new FileInfo(PPTOutputPath); long sz = PPTFileNewfile.Length; context.Response.ClearContent(); context.Response.ContentType = MimeType(Path.GetExtension(PPTOutputPath)); context.Response.AddHeader("Content-Disposition", string.Format("attachment; filename = {0}", System.IO.Path.GetFileName(PPTOutputPath))); context.Response.AddHeader("Content-Length", sz.ToString("F0")); context.Response.TransmitFile(PPTOutputPath); context.Response.Flush(); context.Response.End(); }
function CallHandler(PPTOutputPath) { $.ajax({ type: 'POST', url: "MyHandler.ashx?DownLoadFileName=" + PPTOutputPath, contentType: "application/json; charset=utf-8", dataType: "json", data: "{'imageData': '" + PPTOutputPath + "'}", responseType: "json", success: OnComplete, error: OnFail }); return false; } function OnComplete(result) { alert('Ajax success'); } function OnFail(result) { alert('Ajax failed'); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)