cancel
Showing results for 
Search instead for 
Did you mean: 

Crystal Reports Disable Login Prompt

joe_mancini
Explorer
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

joe_mancini
Explorer
0 Kudos

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.

Former Member
0 Kudos

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

joe_mancini
Explorer
0 Kudos

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

Former Member
0 Kudos

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.

[original link is broken]

Regards,

Jonathan

joe_mancini
Explorer
0 Kudos

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

joe_mancini
Explorer
0 Kudos

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!

Answers (3)

Answers (3)

Former Member
0 Kudos

Hello,

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.

Regards,

Amira

former_member183750
Active Contributor
0 Kudos

Hi Amira

You attached your self to a Discussion that is 5 years old. Please do create a new discussion and have a look at the following blog re. what info to provide:

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow me on Twitter

joe_mancini
Explorer
0 Kudos

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?

Former Member
0 Kudos

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

Former Member
0 Kudos

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

joe_mancini
Explorer
0 Kudos

Hi Jonathan,

Yes, ideally I would like for a no prompt, Trusted Connection solution. Though you said that is tricky, so I'm willing to listen to other ideas also. Is there a document/link that details how to set up a Crystal Report with a No Prompt/Trusted Connection?

Thanks!

Joe

Former Member
0 Kudos

Hi, Joe;

Have a look at this document, it should get you going:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b021e47e-be1d-2b10-c6b2-efa9db3a...

Regards,

Jonathan