Solved

Print Button shows error from Crystal viewer in asp.net 2.0 application after deploying to live server

Posted on 2008-10-18
3
617 Views
Last Modified: 2013-11-07
We have deployed our asp.net 2.0 application onto the live server. We are using Crystal Reports XI Release 2 for the reports and displaying the same in Crystal viewer. When user clicks Report the viewer displays the report correctly. When user clicks Print button on the viewer control, he gets the first screen where he clicks ok and gets a dialog box for Open / Save pdf. When he clicks open, we get error, in one pc is displays - There was an error opening this document, this file could not be found, in Another it displays Access is denied - with a path to c:\windows\temp\...
0
Comment
Question by:venkatca
  • 2
3 Comments
 
LVL 100

Expert Comment

by:mlmcc
ID: 22748655
Check the permissions on the server C:\Windows\temp directory.

mlmcc
0
 
LVL 1

Author Comment

by:venkatca
ID: 22751077
Already given permissions to IUSR and Network Services to c:\windows\temp directory. Also by default crystal viewer print option in asp.net 2.0 opens a dialog box to open the file in acrobat reader from where the user can print. The acrobat reader opens and then the message file cannot be found is displayed from within the reader if user chooses to Open it. If saved and opened, there is no problem.
0
 
LVL 1

Accepted Solution

by:
venkatca earned 0 total points
ID: 22802870
We finally created our own solution for this by opening the adobe reader ourselves instead of using the default provided by crystal viewer.

For this we created a print button on the form and disabled the print button on the viewer.

The print button code is below
    Protected Sub btnPrint_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnPrint.Click
        Session.Add("ReportSource", rep)
        Dim strpop As String = ""
        strpop = "window.open('RptPrintPage.aspx','PopUpPrint','width=1010,height=650 left=0,top=0 scrollbars=yes,status=yes');"
        ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "popup", strpop, True)
    End Sub

And in the rptprintpage.aspx which shows the report in pdf for printing, we added the following in page init


    Protected Sub Page_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Init
        Try
            rep = New ReportDocument()
            If Session("ReportSource") Is Nothing = False Then
                rep = CType(Session("ReportSource"), ReportDocument)
            End If

            Response.Buffer = False
            Response.ClearContent()
            Response.ClearHeaders()
            rep.ExportToHttpResponse(ExportFormatType.PortableDocFormat, Response, False, "Report")

        Catch ex As Exception

        End Try
    End Sub
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question