Response.BinaryWrite or something causes multiple posts
From: Dan C (DanC_at_discussions.microsoft.com)
Date: 08/19/04
- Next message: AT: "Internet Explorer WebControls"
- Previous message: Carlos Oliveira: "BC30289: Statement cannot appear within a method body. End of method assumed."
- Next in thread: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Reply: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Reply: bruce barker: "Re: Response.BinaryWrite or something causes multiple posts"
- Reply: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 19 Aug 2004 13:03:02 -0700
I think this is probably going to be an obscure problem nobody has seen, but
I'll give it a shot.
I have two pages in a system. the first:
1) queries a database and builds a pdf file using a third party control
2) writes the pdf to a file
3) redirects to the second page.
the second page
1) reads the file written by the first page in to a FileStream
2) writes the contents to a byte array
3) Response.BinaryWrite's the byte array
4) File.Delete's the file
the reason I am doing it this way are that the third-party pdf generator
causes a security warning when trying to write directly to the response
stream, but I don't want the file sitting around forever. I know there are
other ways, but I want to know why this particular one won't work.
there are two ways the first page is accessed, through a Response.Redirect,
and through an html anchor with a target of "_blank". when the browser
navigates to the first page through the Redirect, everything works
beautifully. the first page writes the pdf, the second page reads it, writes
the contents, and deletes it without any problems.
however, when the first page is accessed through an anchor with the _blank
target, there are problems because, somehow, two http requests are generated
for the second page. the first request, I assume, works fine. the pdf file
does get read and deleted. but somewhere in the process, the browser issues
another request, and since the file has been deleted by the first request,
the page doesn't work. the second request does not have the http_referrer set
in the post, and it is not a post back.
does that make sense to anybody? and why would that happen?
thanks for any insight you might have!
- Next message: AT: "Internet Explorer WebControls"
- Previous message: Carlos Oliveira: "BC30289: Statement cannot appear within a method body. End of method assumed."
- Next in thread: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Reply: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Reply: bruce barker: "Re: Response.BinaryWrite or something causes multiple posts"
- Reply: Brad Roberts: "RE: Response.BinaryWrite or something causes multiple posts"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|