473,395 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

BinaryWrite cause problem with browser Back button

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
Nov 19 '05 #1
1 2086
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


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: jasonbrown1999 | last post by:
Someone told me the following script could be used to run harmful commands on the server, by passing commands into the script. What the script does is encode an affiliate URL, create two frames,...
2
by: Jens S0nderby Munk | last post by:
Hi, I'm having some problems with the Reponse.BinaryWrite, IE 6.0 and Adobe Reader 6.0. When I try to write a pdf-file to an IE browser with a Adobe Reader 6.0 installed then it just displays a...
1
by: Kevin Humphreys | last post by:
Hi All, Please help me regarding the 'Response.BinaryWrite' I am making one web application where I need to store some of client logo's and others images. In this context I am able to store...
5
by: katrinaVictim | last post by:
Question: I get the eror listed at the bottom of the post. What can I do to make the response of the x1.send a "binary" type? Or, in general, how can I just "make this work"? <%@...
11
by: Random | last post by:
I have tried all the Response methods I can think of (WriteFile, BinaryWrite, OutputStream) to write the byte array of a pdf file to the response. The result looks like it's trying, it comes up as...
0
by: csgraham74 | last post by:
Hi guys back again with another issue. im trying to develop an application which displays a pdf document using the binary.write method. i have 2 pages A and B what i want to do is to load...
2
by: Gary Blakely | last post by:
In my aspx program I'm writing a PDF report to the client browser as follows... Response.BinaryWrite(myBuffer) Response.End() This works successfully about 99% of the time but some I.E....
6
by: Alec MacLean | last post by:
Hi, I've created a small application for our company extranet (staff bulletins) that outputs a list of links to PDF's that are stored in a SQL table. The user clicks a link and the PDF is...
1
by: mattridings | last post by:
Hi gang, Have a script that works fine. However, it's really cpu intensive and I'm looking for suggestions on a) whether or not that's normal and if so b)a better way of doing it. Script is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.