HTTP headers ? How to pipe an ASP file through ?

Discussion in 'ASP General' started by jethro_uk@hotmail.com, Jul 11, 2006.

  1. Guest

    Hi Guys,

    I have a problem, and I would be grateful for any help.

    My WebApp has to do some database work in page1.ASP Because this may
    take a few second, before Page1 connects to the database, it doeas a
    "Response.Buffer=false", and pumps out a bit of javascript which
    displays a progress bar.

    SO far so good.

    When the database call is completed, I then write out a bit more
    javascript to stop the progress bar.

    Now, I have a binary fields retrieved from the database, which needs to
    be written like this :

    <%
    Response.ContentType = "application/pdf" [error]
    response.BinaryWrite (mydatabase field)
    %>

    Of course I am getting an error about HTTP headers having been written
    already.

    Can anyone suggest a way that I can display this PDF from Page1.asp ?
    At the moment, one I have done the database work (which populates the
    database) I have to transfer to PAGE2.ASP which then has to open the
    database, and retrieve the field again. The problem is that this
    process takes a few seconds too, which also requires the progressbar
    !!!!!

    What I would like to do, (if it's possible) is something like this :

    PAGE1.ASP
    <%
    ....[code to intialise progressbar]...
    ....[database call]...
    ....[clear progress bar]...
    ....[write db field as PDF]...
    %>

    thanks in advance
    , Jul 11, 2006
    #1
    1. Advertising

  2. <> wrote in message
    news:...
    > Hi Guys,
    >
    > I have a problem, and I would be grateful for any help.
    >
    > My WebApp has to do some database work in page1.ASP Because this may
    > take a few second, before Page1 connects to the database, it doeas a
    > "Response.Buffer=false", and pumps out a bit of javascript which
    > displays a progress bar.
    >
    > SO far so good.
    >
    > When the database call is completed, I then write out a bit more
    > javascript to stop the progress bar.
    >
    > Now, I have a binary fields retrieved from the database, which needs to
    > be written like this :
    >
    > <%
    > Response.ContentType = "application/pdf" [error]
    > response.BinaryWrite (mydatabase field)
    > %>
    >
    > Of course I am getting an error about HTTP headers having been written
    > already.
    >
    > Can anyone suggest a way that I can display this PDF from Page1.asp ?
    > At the moment, one I have done the database work (which populates the
    > database) I have to transfer to PAGE2.ASP which then has to open the
    > database, and retrieve the field again. The problem is that this
    > process takes a few seconds too, which also requires the progressbar
    > !!!!!
    >
    > What I would like to do, (if it's possible) is something like this :
    >
    > PAGE1.ASP
    > <%
    > ...[code to intialise progressbar]...
    > ...[database call]...
    > ...[clear progress bar]...
    > ...[write db field as PDF]...
    > %>
    >


    The request should ultimately return a PDF. Since a PDF doesn't begin with
    Javascript code you've corrupted the download before you have even begun.

    One thing you might try is an accessor page which launches a modeless dialog
    containng your progress bar then navigates to the page that delivers the
    PDF. The when the PDF starts to download the internal window containing
    your accessor page will be closed to be replaced with the PDF at this point
    the modelss dialog will be closed automatically for you.

    I'm not sure how this would work in a non-IE environment though.

    > thanks in advance
    >
    Anthony Jones, Jul 11, 2006
    #2
    1. Advertising

  3. Sean Harrop Guest

    Not sure if this follows your business rules, but what I've done in the past
    is create an actual PDF file in a temp virtual directory, and then have the
    page that created the file redirect to that file. If the information is
    sensitive, make sure you have some sort of cleanup routine (possibly
    triggered when a session ends).

    "" wrote:

    > Hi Guys,
    >
    > I have a problem, and I would be grateful for any help.
    >
    > My WebApp has to do some database work in page1.ASP Because this may
    > take a few second, before Page1 connects to the database, it doeas a
    > "Response.Buffer=false", and pumps out a bit of javascript which
    > displays a progress bar.
    >
    > SO far so good.
    >
    > When the database call is completed, I then write out a bit more
    > javascript to stop the progress bar.
    >
    > Now, I have a binary fields retrieved from the database, which needs to
    > be written like this :
    >
    > <%
    > Response.ContentType = "application/pdf" [error]
    > response.BinaryWrite (mydatabase field)
    > %>
    >
    > Of course I am getting an error about HTTP headers having been written
    > already.
    >
    > Can anyone suggest a way that I can display this PDF from Page1.asp ?
    > At the moment, one I have done the database work (which populates the
    > database) I have to transfer to PAGE2.ASP which then has to open the
    > database, and retrieve the field again. The problem is that this
    > process takes a few seconds too, which also requires the progressbar
    > !!!!!
    >
    > What I would like to do, (if it's possible) is something like this :
    >
    > PAGE1.ASP
    > <%
    > ....[code to intialise progressbar]...
    > ....[database call]...
    > ....[clear progress bar]...
    > ....[write db field as PDF]...
    > %>
    >
    > thanks in advance
    >
    >
    Sean Harrop, Aug 31, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lee, wonsun
    Replies:
    1
    Views:
    485
    Jack Klein
    Nov 2, 2004
  2. dont bother
    Replies:
    0
    Views:
    792
    dont bother
    Mar 3, 2004
  3. Phil
    Replies:
    4
    Views:
    667
    Gabriel Genellina
    Jan 17, 2010
  4. Ian
    Replies:
    2
    Views:
    1,938
  5. Replies:
    1
    Views:
    222
    Ben Morrow
    Jun 2, 2004
Loading...

Share This Page