By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,383 Members | 2,063 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,383 IT Pros & Developers. It's quick & easy.

Page_Load event fires twice when streaming a PDF.

P: n/a
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

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

'stream report to pdf without writing a file
to disk
exp.ExportFormatType =
exp.FormatOptions = New PdfRtfWordFormatOptions
req.ExportInfo = exp
Dim st As Stream =

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

Response.ContentType = "application/pdf"

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.
End Sub

#End Region

End Class
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.