Re: BinaryWrite cause problem with browser Back button

Tech-Archive recommends: Fix windows errors by optimizing your registry



One idea is to store the parameters in the ASP.NET data Cache (and give it a timeout... say 1 minute) and index the Cache by a new Guid you create dynamically. Then send a Response.Redirect to the new URL with the Guid QueryString where it can look up the parameters form the cache based upon the QueryString, then load whatever data it needs and then send back the response.

-Brock
DevelopMentor
http://staff.develop.com/ballen



I want to generate a report and display it as a pdf in a WebForm
(RptForm). To generate the report I need to pass some (sometimes a lot
of) parameters from a WebForm (WebForm1).

The report looks fine when I use Response.BinaryWrite to create it:

oStream =
(MemoryStream)oRpt.ExportToStream(CrystalDecisions.Shared.ExportFormat
Type.PortableDocFormat);

Response.Clear();

Response.Buffer= true;

Response.ContentType = "application/pdf";

Response.BinaryWrite(oStream.ToArray());

Response.End();

The problem I have is that once I have created the pdf with
BinaryWrite I want the back button in the browser to send me back to
WebForm1. But the back button will send me back to the page that
called WebForm1. If I view the report without creating a pdf the back
button works fine.

Since the parameter string is sometimes too long for a
Request.QueryString I use Server.Transfer() to pass the parameters to
the ReportForm:
//ReportForm
WebForm1 sourcePage = (WebForm1)Context.Handler;
string param = sourcePage.param;
It's OK to open the RptForm in a new browser window. But how can I get
my paramer string passed to that new window when I can't use
Request.QueryString?

/Magnus




.


Quantcast