BinaryWrite cause problem with browser Back button

M

Magnus

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.ExportFormatType.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
 
B

Brock Allen

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top