GoDaddy.com Error - The type initializer for 'CrystalDecisions.CrystalReports.Engine.ReportDocument' threw an exception. RRS feed

  • Question

  • User-1547820999 posted

    Hello all,

    I am getting the above error when trying to create the report.  It is when it does the "crChecklist = New ReportDocument" statement.  Here is my code below:

    Protected Sub cmdSendEmail_Click(sender As Object, e As System.EventArgs) Handles cmdSendEmail.Click
            Dim crChecklist As ReportDocument
            Dim strReportName As String
            Dim myTable As DataTable
            'Save as PDF
            Dim CrExportOptions As ExportOptions
            Dim CrDiskFileDestinationOptions As New DiskFileDestinationOptions()
            Dim CrFormatTypeOptions As New PdfRtfWordFormatOptions()
            lblMsg.Text = Nothing
            lblMsg.Visible = False
            myTable = CType(Session("myDatatable"), DataTable)
            If myTable.Rows.Count = 0 Then
                lblMsg.Text = "You need to have entered at least one task before you can send an email"
                lblMsg.Visible = True
                Exit Sub
            End If
            strReportName = Server.MapPath("Reports\") & Replace(txtName.Text, " ", "_") & ".pdf"
            lblChecklistRptName.Text = strReportName
                crChecklist = New ReportDocument
                crChecklist.SetParameterValue("pUserName", txtName.Text)
                crChecklist.SetParameterValue("pUserPicture", lblPictureFileName.Text)
                crChecklist.SetParameterValue("pLogo", "Images/BPTexas_Logo.png")
                CrDiskFileDestinationOptions.DiskFileName = strReportName
                CrExportOptions = crChecklist.ExportOptions
                With CrExportOptions
                    '// Set the destination to a disk file
                    .ExportDestinationType = ExportDestinationType.DiskFile
                    '// Set the format to PDF
                    .ExportFormatType = ExportFormatType.PortableDocFormat
                    '// Set the destination options to DiskFileDestinationOptions object
                    .DestinationOptions = CrDiskFileDestinationOptions
                    .FormatOptions = CrFormatTypeOptions
                End With
                '// Export the report
            Catch err As Exception
                lblMsg.Text = err.Message
                lblMsg.Visible = True
                Exit Sub
            End Try
            'Send Email
            Dim SMTP_User As String
            Dim SMTP_pass As String
            Dim SMTP_server As String
            Dim SMTP_Port As String
            Dim SMTP_SSL As Boolean
            SMTP_User = AppSettings("SMTP_User")
            SMTP_pass = AppSettings("SMTP_Password")
            SMTP_server = AppSettings("SMTP_server")
            SMTP_Port = AppSettings("SMTP_Port")
            If AppSettings("EnableSsl") = "True" Then
                SMTP_SSL = True
                SMTP_SSL = False
            End If
            Dim client As New SmtpClient
            Dim [from] As New MailAddress(AppSettings("noreply_email"))
            Dim [to] As New MailAddress(AppSettings("EmailInfo"))
            Dim message As New MailMessage([from], [to])
            message.Subject = "Checklist For " & txtName.Text
            message.Body = "Here is the checklist for " & txtName.Text
            message.IsBodyHtml = False
            message.Attachments.Add(New Attachment(strReportName))
            client.Host = SMTP_server
            client.Port = SMTP_Port
            client.EnableSsl = SMTP_SSL
            client.UseDefaultCredentials = True
            client.Credentials = New Net.NetworkCredential(SMTP_User, SMTP_pass)
            txtName.Text = Nothing
            txtSectionName.Text = Nothing
            ddlTasks.SelectedIndex = 0
            CrDiskFileDestinationOptions.DiskFileName = Nothing
            Session("myDatatable") = Nothing
            ddlTasks.SelectedIndex = ddlTasks.Items.IndexOf(ddlTasks.Items.FindByValue("< Select Task >"))
            myTable = Nothing
            gvAssignedTasks.DataSource = myTable
            lblMsg.Text = "Checklist has been sent"
            lblMsg.Visible = True
        End Sub

    I have changed everything that I know.  I am on the old hosting and not using their PLESK hosting.  I changed the IIS to be Classic and not Integrated.  I am not sure what else to do.

    If there is anything else that you need, please let me know.


    Eddi Rae

    Wednesday, March 4, 2015 1:39 PM

All replies

  • User-1315512054 posted


    The problem is that GoDaddy do not support Crystal Reports with their shared ASP.NET hosting plans. It will be better to ask their support.


    Wednesday, March 4, 2015 2:00 PM
  • User311508580 posted

    Hi EddieRae,

    You need to ask whether Godaddy support for Crystal Report or not. From the error message, your application requires Crystal report

    Friday, March 6, 2015 3:52 AM