Link to home
Start Free TrialLog in
Avatar of footpaul
footpaul

asked on

Unable to connect: incorrect log on parameters. intermittent error message when trying to view a crystal report in an asp.net website.

I have an asp.net website hosted on an internal server running Server 2008 and IIS 7. This website has been in place for a while and has been working fine, then, last week we had an error in a crystal report on the website. The error is:

Error in File C:\Windows\TEMP\FactSheet {80059080-F1AB-4934-A9B1-D05F4A5EF3E1}.rpt: Unable to connect: incorrect log on parameters.

This error would show up anytime a user would try to view the report from any machine but the report name would change to reflect the temp report file. At the time, we restarted IIS completely and this solved the problem. Everything then worked fine until about 3 or 4 days later when the same error occurred again. This time, we restarted IIS on the default website and again, this solved the problem. I am hoping this doesn't become a routine for us to have to restart IIS every few days so I am hoping someone out there will have some advice for me.
Avatar of Mike McCracken
Mike McCracken

What version of Crystal?

What code is running the report?

mlmcc
Avatar of footpaul

ASKER

Users have Crystal 13 installed on their PC's but the reports in the website haven't been converted to Crystal 13, they are Crystal 11.

This is the code that loads the report:

CrystalView.ToolbarStyle.Width = New Unit("800px")
        report.Load(Server.MapPath(Session("Report")))
        If Session("Report") = "../Reports/History.rpt" Or Session("Report") = "../Reports/FactSheet.rpt" Then
            report.SetParameterValue(0, CInt(Session("ConsumerID")))
            report.SetDatabaseLogon("****", "********")
        End If
        CrystalView.ReportSource = report
        If Session("Report") = "../Reports/FactSheet.rpt" Then
            'Open connection
            Dim con As New SqlConnection()
            con.ConnectionString = "Data Source=*****;Initial Catalog=*********************;Integrated Security=True;Max Pool Size=200"
            con.Open()
            'Identify CCMS Data Entry Person
            Dim cmdCCMS As SqlCommand = New SqlCommand( _
            "SELECT ... FROM ...WHERE ...= '" & Session("User") & "' AND ... IN " & _
                "(SELECT ... FROM ...WHERE ...)", con)
            Dim iCCMS As Integer = cmdCCMS.ExecuteScalar
            'If Session("User") = sCCMS Or Session("User") = "***" Or Session("User") = "***" Or Session("User") = "***" Or Session("User") = "***" Then
            If iCCMS > 0 Or Session("User") = "***" Or Session("User") = "***" Or Session("User") = "***" Or Session("User") = "***" Or Session("User") = "***" Then
                btnExport.Visible = True
            Else
                btnExport.Visible = False
            End If
        End If

Open in new window

SOLUTION
Avatar of Mike McCracken
Mike McCracken

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The Fact Sheet.rpt is the one we are having issues with although I haven't tried the other reports when the issue is occurring. The user pcs do have crystal 11 installed. Like I said, it is an intermittent problem, currently, everything is working fine, but after 3 or 4 days, we will get the log on error when trying to view the report, then we restart IIS and everything is back to normal again.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the page unload event we do have the following:
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
        report.Close()
        report.Dispose()
    End Sub

Open in new window

I did find another post saying that if a user cancels the report or closes the browser at any point of opening/printing the report, this can cause the close and dispose code not to run, leaving the temp files open on the server. Their solution was restarting IIS at a scheduled off hours time (not a great solution in my mind) or running java script on the page to find the page close event and clean up the temp files then (also doesn't seem like the greatest solution and doesn't explain to me why this problem just started occurring).
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
My reason for accepting my own solution is because while mlmcc had some good tips, he did not discover the actual factor causing our problem.