KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm requesting .ashx page from Master page client side script (Jquery) which has a code to download a PDF file. When I debug it, I can see the execution of "file download" code but file is not downloading. $.ajax({ type: "POST", url: "FileDownload.ashx", dataType: "html", success: function (data) { } } ); public class FileDownload : IHttpHandler { public void ProcessRequest(HttpContext context) { //context.Response.ContentType = "text/plain"; //context.Response.Write("Hello World"); string fileName = "BUSProjectCard.pdf"; string filePath = context.Server.MapPath("~/Print/"); context.Response.Clear(); context.Response.ContentType = "application/pdf"; context.Response.AddHeader("Content-Disposition", "attachment; filename="+fileName); context.Response.TransmitFile(filePath + fileName); context.Response.End(); }
Tags (comma-separated)
Save Edits
Cancel