Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8704299
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:04:00+00:00 2026-06-13T03:04:00+00:00

In my Asp.net webforms site I have a form where users select various options

  • 0

In my Asp.net webforms site I have a form where users select various options and those options are sent back in a postback that generates a PDF report and sends that file back to the user for download via the following code:

    protected void btnTopGenReport_Click(object sender, EventArgs e)
    {
        var stream = new PodMainReportGenerator().GenerateReport(GetReportParameters());

        var bytes = stream.ToArray();
        stream.Close();

        // Set the content headers
        Response.Clear();
        Response.Buffer = true;
        Response.ContentType = "application/pdf";
        Response.AddHeader("Content-Disposition", "attachment;filename=testReport.pdf");
        Response.AddHeader("Content-Length", bytes.Length.ToString());

        Response.BinaryWrite(bytes);

        Response.End();
    }

The problem is this report can take a good 10 or so seconds to generate due to the amount of data and processing required, but I don’t want people getting impatient and clicking the button over and over again.

In a normal page I would add javascript to disable the buttons on click. This works because when postback is complete the server comes back with the form buttons re-enabled. However, since the form’s response is not an HTML page but a downloaded file, which I don’t know how to detect.

Essentially, how do I disable the form’s buttons but re-enable them once we get the response from the server (and the http file transfer is initiated)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T03:04:01+00:00Added an answer on June 13, 2026 at 3:04 am

    You just need an indicator outside of the response content to notify you that the download is complete. Try using a cookie monitor, where you set the cookie as part of the download response, and in your main page, monitor for the existence of that cookie.

    http://gruffcode.com/2010/10/28/detecting-the-file-download-dialog-in-the-browser/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a web site that runs both classic ASP and ASP.NET Webforms. The
I have an ASP.NET Webforms site that is regularly having features added. The majority
Brief introduction: I have this ASP.NET Webforms site with the particularity that it doesn't
I have an ASP.NET 4.0 WebForms site that is running on a IIS6/Server 2003
I'm using IIS7.5. I have a simple ASP.NET webforms site that uses basic URL
Some site I'm programming is using both ASP.NET MVC and WebForms. I have a
I have a ASP.NET 4.0 webforms site where I have the MasterPage so it
In WebForms ASP.NET site (IIS, single app pool), I have call to lengthy web
I have a site written in Asp.net webforms. It uses ajax heavily. Most forms
im building a high traffic asp.net webforms site. I have componentized all the urls

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.