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
603 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
Comment Utility
Check the permissions on the server C:\Windows\temp directory.

mlmcc
0
 
LVL 1

Author Comment

by:venkatca
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now