I have an ASP.NET(3.5) web application. My app. generates excel/pdf reports for users.
I use Response.TransmitFile to make users download the report. It can take some time(~5 mins.) to produce a report. I don't want users to click "Report" button while report is generated.
I disable "Report" button in javascript when it is pressed but I cannot enable again after I use Response.TransmitFile.
I don't want to enable the button manually after some time in javascript or add a cookie to Response and check it continuously in javascript whether cookie is created or not.
Is there a way to deal with this by using HTTPHanlder or any other suggestions?
Yes you can done through httpHandler. Give Handler relative path to hyperlink. Send input parameters in query string.And access data from your storage. and write the content.
Yes you can done through httpHandler. Give Handler relative path to hyperlink. Send input parameters in query string.And access data from your storage. and write the content.
<%@ WebHandler Language="C#" Class="Handler" %>
using System;
using System.Web;
public class Handler : IHttpHandler {
public void ProcessRequest (HttpContext context) {
HttpResponse r = context.Response;
r.ContentType = "image/png";
//
// Write the requested image
//
string file = context.Request.QueryString["file"];
// Get Data From Database. And write file.
if (file == "logo")
{
r.WriteFile("Logo1.png");
}
else
{
r.WriteFile("Flower1.png");
}
}
public bool IsReusable {
get {
return false;
}
}
}
None
0 Points
5 Posts
Using HTTPHandler for file downloading
Dec 26, 2011 04:44 AM|skosko|LINK
Hi All,
I have an ASP.NET(3.5) web application. My app. generates excel/pdf reports for users.
I use Response.TransmitFile to make users download the report. It can take some time(~5 mins.) to produce a report. I don't want users to click "Report" button while report is generated.
I disable "Report" button in javascript when it is pressed but I cannot enable again after I use Response.TransmitFile.
I don't want to enable the button manually after some time in javascript or add a cookie to Response and check it continuously in javascript whether cookie is created or not.
Is there a way to deal with this by using HTTPHanlder or any other suggestions?
Thanks.
httphandler
Member
270 Points
88 Posts
Re: Using HTTPHandler for file downloading
Dec 26, 2011 10:26 AM|Thulasiram|LINK
Yes you can done through httpHandler. Give Handler relative path to hyperlink. Send input parameters in query string.And access data from your storage. and write the content.
None
0 Points
5 Posts
Re: Using HTTPHandler for file downloading
Dec 26, 2011 10:39 AM|skosko|LINK
Hi,
I am not familiar with HTTPHandler concept.
Could you share an example?
Thanks.
Member
270 Points
88 Posts
Re: Using HTTPHandler for file downloading
Dec 26, 2011 11:12 AM|Thulasiram|LINK