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 5946997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T16:54:07+00:00 2026-05-22T16:54:07+00:00

I have a process that sends a PDF to the user via Response.BinaryWrite(pdf); After

  • 0

I have a process that sends a PDF to the user via

Response.BinaryWrite(pdf);

After this completes, I want to

Response.Redirect("Default.aspx");

The problem is that the redirect fires before the BinaryWrite() has completed. I know this because I do not see the popup to download the PDF as I should.

If I remove

Response.Redirect("Default.aspx");

Then I get the popup as I should. So, there’s a race condition here (probably has something to do with HTTP being connectionless). I could do

Thread.Sleep(5000);

But that is ridiculous. Is there a good solution to this problem?


I tried AJAX. This isn’t working either. Due to an issue with AJAX and popups, I have to use the workaround

window.frames["#pdfPopup"].location.reload();

To get my popup to display.

Then this code never runs…

alert('before href');//no alert ever displays
window.location.href = "http://www.yahoo.com/";

This could be because I called reload(). Any ideas?


I hooked into onload for the frame, but this still doesnt work! Ugh. I read that onload does not fire for frames that contain activeX controls, including PDF. I read this on SO and multiple google sites.

<iframe id="pdfPopup" style="visibility:hidden;height:0px;width:0px;" onload="Redirect();"></iframe>

onload does fire on page load, but not when I call reload and put a PDF in there. So I have hit a brick wall. Anybody have any solutions for this?

  • 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-05-22T16:54:08+00:00Added an answer on May 22, 2026 at 4:54 pm

    Instead of using document.href open the pop-up window through window.open on client side and pass the URL to download the PDF there. Then you can perform the redirect

    window.open("PDFService.aspx?param1=...");
    document.location.href = "Default.aspx";
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program that generates a PDF as output. If I send this
I have a small Mongrel webserver that sends the stdout of a process to
I have a C# process that prints an in memory pdf file using O2S.Components.PDFRender4NET,
I need to have a process that compiles daily data into an PDF that
I'm developing a site that sends email notifications to users after certain events/user actions
I have a django project that uses a worker process that sends emails to
I have a process that sends to printer a large amount of .doc files
I have code that sends a message into a MessageQueue . _queue.Send(new Message(myData)); This
I have Process objects that are monitored from two different views. A Windows.Forms.ListView (actually
I have 1 process that receives incoming connection from port 1000 in 1 linux

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.