Click here to Skip to main content
16,018,442 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Logon failed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:


[LogOnException: Logon failed.]
.F(String  , EngineExceptionErrorID 
)
.A(Int16 , Int32 )
.@(Int16 )
CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext)
CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext)
CrystalDecisions.Web.ReportAgent.u(Boolean N)
CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e)
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Control.PreRenderRecursiveInternal()
System.Web.UI.Page.ProcessRequestMain()

what may be the solution??
Posted

1 solution

this problem may come if your Server Name / Database Name is different from what u have selected at design time

To solve this problem-
VB
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine

Public Shared Sub Sub_CRCrystalLogon(ByRef rpt As CrystalDecisions.CrystalReports.Engine.ReportDocument)

''CrystalReport1' must be the name the CrystalReport

Dim crTableLogOnInfo As TableLogOnInfo = New TableLogOnInfo

Dim crConnectionInfo As ConnectionInfo = New ConnectionInfo

'Crystal Report Properties

Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database

Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables

Dim crTable As CrystalDecisions.CrystalReports.Engine.Table

'Then, use following code sample to add the logic in the Page_Load method of your Web Form:

crConnectionInfo.ServerName = Server Name

crConnectionInfo.DatabaseName = DataBaseName

crConnectionInfo.UserID = DBUserID

crConnectionInfo.Password = DBPassword

crDatabase = rpt.Database

crTables = crDatabase.Tables

For Each crTable In crTables

crTableLogOnInfo = crTable.LogOnInfo

crTableLogOnInfo.ConnectionInfo = crConnectionInfo

crTable.ApplyLogOnInfo(crTableLogOnInfo)

Next

End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900