Skip to Content

Crystal Reports Disable Login Prompt

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?

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jan 05, 2010 at 08:05 PM

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


    Dim myReport As New ReportDocument()

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

    myReport.DataSourceConnections(0).IntegratedSecurity = True

    CrystalReportViewer1.ReportSource = myReport

    Catch ex As Exception


    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 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.

    Add comment
    10|10000 characters needed characters exceeded

    • I opened up a support case and I got my question answered. Here's what you need to do to get your 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



      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!

  • avatar image
    Former Member
    Dec 31, 2009 at 09:13 PM

    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:

    Happy New Year


    Follow us on Twitter

    Add comment
    10|10000 characters needed characters exceeded

  • Jan 04, 2010 at 09:26 PM


    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?

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.



  • avatar image
    Former Member
    May 26, 2015 at 01:11 PM


    I am developing an ASP.NET application using crystal reports in it, I suffered trying to remove or bypass that logon security popup but nothing was useful, please help, knowing that I am connecting to mysql database for  this report,

    Thank you.



    Add comment
    10|10000 characters needed characters exceeded