473,511 Members | 15,477 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Page_Load event fires twice when streaming a PDF.

When attempting to write a PDF stream to the web browser,
the Page_Load event fires twice if a user has Internet
Explorer configured to 'Check for newer versions of stored
pages: Every visit to the page'. This is causing me
tremendous grief. Here's an abstract of code to prove the
problem. New FirstReport() is a blank report. Can
someone please tell me how to stop this behaviour?

Thanks Greatly

<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="WebForm0.aspx.vb" Inherits="MyReport.WebForm0"%

Imports System.IO
Imports CrystalDecisions.Shared
Imports CrystalDecisions.Web
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.CrystalReports.Engine

Public Class WebForm0 : Inherits System.Web.UI.Page

Private Sub Page_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load

Dim myRep As
CrystalDecisions.CrystalReports.Engine.ReportClass = New
FirstReport()

Dim exp As New ExportOptions()
Dim req As New ExportRequestContext()

'stream report to pdf without writing a file
to disk
exp.ExportFormatType =
ExportFormatType.PortableDocFormat
exp.FormatOptions = New PdfRtfWordFormatOptions
()
req.ExportInfo = exp
Dim st As Stream =
myRep.FormatEngine.ExportToStream(req)

Dim buffer(st.Length) As Byte
st.Read(buffer, 0, CInt(st.Length))

Response.ClearHeaders()
Response.ClearContent()
Response.Clear()
Response.ContentType = "application/pdf"
Response.BinaryWrite(buffer)
Response.End()

End Sub

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private
Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the
Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

End Class
Jul 21 '05 #1
0 1435

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

Similar topics

1
3936
by: Jon | last post by:
Hi, I've set up a new web form (new.aspx) that inherits a BasePage class. The new web form contains an override Page_Load event. In BasePage, Page_Load is declared 'virtual'. In the new web...
7
2089
by: Jay Douglas | last post by:
Hello all, I have a asp.net page that creates a pdf on the fly and sends the pdf down to the browser. When calling the page up in IE the Page_Load event is fried twice. This doesn't happen with...
4
1704
by: Ed | last post by:
Has anyone seen this one? I have a situation where code in my page_load event is firing twice for mozilla firefox users. Everything is fine in IE6. I set breakpoints and verified. The second time...
14
13092
by: V. Jenks | last post by:
I'm a little rusty having not touched .NET for 6 months and I can't remember why Page_Load is happening twice in this code: private void Page_Load(object sender, System.EventArgs e) {...
3
2416
by: doobdave | last post by:
Hi all, I'm experiencing a rather strange problem: I am coding a web application using VB.net ASP.net and Visual Studio 2003. It's quite a large application, but the problem only occurs on...
4
3946
by: Seraph | last post by:
Again, I'm rather new here, so if I fail to follow any etiquette, please forgive me and let me know what I've done wrong, but I think this might interest quite a few people. One of my colleaques...
0
1925
by: pat.allan | last post by:
Hi All This seems to be a common problem here, but I've not found a solution yet to fix it for me. When I request a page through a browser, the page_load fires once. When I request the page's...
0
257
by: Gary | last post by:
When attempting to write a PDF stream to the web browser, the Page_Load event fires twice if a user has Internet Explorer configured to 'Check for newer versions of stored pages: Every visit to...
1
1825
by: =?Utf-8?B?TWlrZXkgQmFieQ==?= | last post by:
Greetings Hopefully, I can be clear and concise on this one, but I'm confused. I have a page with a ListBox <- ODS <- BusinessObject and a button. The Parameter Source is 'None'. The Default...
0
7153
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
7432
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...
1
7093
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
7517
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...
0
5676
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1583
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
452
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.