11 Replies Latest reply: Jan 29, 2010 3:58 PM by Joe Mancini RSS

Crystal Reports Disable Login Prompt

Joe Mancini
Currently Being Moderated

I've developed an ASP.NET application with a Crystal Reports viewer. I used VS 2008, Crystal 2008, connecting to a SQL 2005 database. I used a System DSN ODBC to connect to SQL in the Crystal Report. My report works fine, both on my development machine and on the Web Server if the Save Data with Report is checked. My issue is that once I uncheck the 'Save Data with Report' option, I get prompted for a database login running the report off of the web server.  I haven't seen anything definitive for an answer while searching the forums.

I've tried to create an odbc connection and use 'Trusted Connection', and re-map my DataSource, but that did not work. I also unchecked the EnableDatabaseLoginPrompt on the Report Viewer in VS.NET, no luck there either. What else can I try?

  • Re: Crystal Reports Disable Login Prompt
    Currently Being Moderated

    Hi, Joe;

     

    Is it your intention to do a trusted connection, or are you just looking for any thing that works? A trusted connection gets a little tricy with a web application, but it can be done.

     

    An easier solution could be passing in the user id and password in code.

     

    Have a look at the following guide for some tips on this:

     

    http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b0225775-88c4-2c10-bd80-8298769293de

     

    Happy New Year

    Jonathan

     

    Follow us on Twitter http://twitter.com/SAPCRNetSup

  • Re: Crystal Reports Disable Login Prompt
    Joe Mancini
    Currently Being Moderated

    Jonathan,

     

    A couple of questions with the link you referenced:

     

    I'm using Crystal 2008 - Will this code work with my version of Crystal?

     

    What does this line of code mean, specifically, SQLReport_LocalDBRpt? How/Where do I find/reference SQLReport_LocalDBRpt?

     

    Dim report as new SQLReport_LocalDBRpt

     

     

    Finally, the document mentions this:

     

    This document applies only to the scenarios where the application and the database server reside on the same computer.

     

    My application is deployed to a web server and my database is on a different database server. It sounds like I can't use these code samples?

    • Re: Crystal Reports Disable Login Prompt
      Currently Being Moderated

      Hi, Joe;

       

      Yes, it should all work fine with CR 2008.

       

      The SQLReport_LocalDBRpt it refers to is a report that was added to the project. For CR 2008, you would have to Load a report from disk, ie:

       

      Dim myRpt as new ReportDocument

      myRpt.Load ("C:\Reports\report1.rpt")

       

      That line doesn't make much sense to me, as who has the database server and web server on the same system. Disregard, as most people are doing this, and it should work just fine.

       

      Regards,

      Jonathan

  • Re: Crystal Reports Disable Login Prompt
    Joe Mancini
    Currently Being Moderated

    Still no luck. This is what I have for code to load the report:

     

            Try

                Dim myReport As New ReportDocument()

                myReport.Load("C:\PhoneDirectory.rpt", OpenReportMethod.OpenReportByDefault)

     

                myReport.DataSourceConnections(0).IntegratedSecurity = True

     

                CrystalReportViewer1.ReportSource = myReport

            Catch ex As Exception

                MsgBox(Err.Description)

            End Try

     

    I set the Directory Security Access on my Virtual Directory to Anonymous Access as the document specifies.

     

    I also added this line to my web.config file:

     

    <identity impersonate=u201Dtrueu201D />

     

    Now, when this line is in my asp.net app, I get the message: Load Report Failed

     

    When I don't have the line above in, I get the message(which I had been getting):  Database logon failed.

     

    In both cases, the report loads fine on my development machine. We're close, but I'm missing something.

    • Re: Crystal Reports Disable Login Prompt
      Currently Being Moderated

      Hi, Joe;

       

      The load report failed usually is a permissions issue. Running the report from the root of the C drive may not be ideal.

       

      Try putting it in the directory that houses your web page, and see if that makes a difference.

       

      Regards,

      Jonathan

      • Re: Crystal Reports Disable Login Prompt
        Joe Mancini
        Currently Being Moderated

        Same issue. Works fine on my development machine. I copied my report to the same directory as where the web page is housed and I got the 2 different error messages as I indicated above, depending on whether or not I have this line of code in the web.config file:

         

        <identity impersonate=u201Dtrueu201D />

         

        Is it a problem as far as where I have this line of code above? I have the code in my web.config as follows:

         

        <authentication mode="Windows"/>

        <identity impersonate="true" />

         

        Joe

        • Re: Crystal Reports Disable Login Prompt
          Currently Being Moderated

          Hi, Joe;

           

          If it is working on one system but not the other, compare the settings between the two systems.

           

          You may want to consider purchasing a phone support case with us, as we've gone about as far as we can here.

          Single Case Support for Crystal Reports and Xcelsius Products [original link is broken]

           

          Regards,

          Jonathan

          • Re: Crystal Reports Disable Login Prompt
            Joe Mancini
            Currently Being Moderated

            I've tried a couple of other ideas, but still am not able to get my web page working. I'll have to do a phone case for this.

             

            Joe

            • Re: Crystal Reports Disable Login Prompt
              Joe Mancini
              Currently Being Moderated

              I opened up a support case and I got my question answered. Here's what you need to do to get your asp.net application working.

               

              In the Page_Load sub in the website.aspx.vb code, add this code in:

               

              Imports CrystalDecisions.Shared

              Imports CrystalDecisions.CrystalReports.Engine

               

                          Dim myConnectionInfo As ConnectionInfo = New ConnectionInfo()

                          Dim myReport As New ReportDocument()

                          myReport.Load(Server.MapPath("ReportName")) 'name of your Crystal Report - see note below

               

                          Dim myTables As Tables = myReport.Database.Tables

               

                          For Each myTable As CrystalDecisions.CrystalReports.Engine.Table In myTables

                              Dim myTableLogonInfo As TableLogOnInfo = myTable.LogOnInfo

                              myConnectionInfo.ServerName = <SQL servername>

                              myConnectionInfo.DatabaseName = "" 'leave database name blank

                              myConnectionInfo.UserID = 'login name

                              myConnectionInfo.Password = 'password

                              myTableLogonInfo.ConnectionInfo = myConnectionInfo

                              myTable.ApplyLogOnInfo(myTableLogonInfo)

                          Next

               

                          CrystalReportViewer1.ReportSource = myReport

               

              A couple of more things:

              Add your Crystal Report as an existing item directly to your project. This will push the report out with your webpage to the web server once you publish your application.

              Only add the Crystal Report Viewer to your application.aspx page. Leave the Report Source blank. The code above will set your report source.

               

              Hope this can help out someone else in the future!

Actions