[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 573
  • Last Modified:

Logon failed

I am using winXP + IIS + ASP.NET + Crystal report.
I have a troubles with crystal report logon failed. How can I fix it up?


==========Error==========
Server Error in '/MyWebApp' Application.
--------------------------------------------------------------------------------

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 
) +506
   .A(Int16 , Int32 ) +537
   CrystalDecisions.CrystalReports.Engine.FormatEngine.GetPage(PageRequestContext reqContext) +539
   CrystalDecisions.ReportSource.LocalReportSourceBase.GetPage(PageRequestContext pageReqContext) +189
   CrystalDecisions.Web.ReportAgent.u(Boolean N) +164
   CrystalDecisions.Web.CrystalReportViewer.OnPreRender(EventArgs e) +108
   System.Web.UI.Control.PreRenderRecursiveInternal() +62
   System.Web.UI.Control.PreRenderRecursiveInternal() +125
   System.Web.UI.Control.PreRenderRecursiveInternal() +125
   System.Web.UI.Page.ProcessRequestMain() +1489

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573





=========WebForm1.aspx.vb============
Public Class WebForm1
    Inherits System.Web.UI.Page

'(+) Web form design generated code

    Public RStaff As New CrystalReport2
    Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'Put user code to initialize the page here
        Dataset21.Clear()
        SqlSelectCommand1.CommandText = "SELECT StudentID, Surname, FirstName, HKID FROM Student"
        SqlDataAdapter1.Fill(Dataset21, "Student")
        RStaff.SetDataSource(Dataset21)
        RStaff.Refresh()
        CrystalReportViewer1.ReportSource = RStaff
    End Sub

End Class
0
ddlam
Asked:
ddlam
  • 4
  • 2
1 Solution
 
mlmccCommented:
You need to provide the logon information to the report and the subreports.

Look at
http://support.businessobjects.com/library/kbase/articles/c2010371.asp

mlmcc
0
 
ddlamAuthor Commented:
but I am using asp.net and Window Authentication
0
 
ddlamAuthor Commented:
Error still exist:


    Public crReportDocument As New CrystalReport2
    Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
    Dim myLogin As CrystalDecisions.Shared.TableLogOnInfo
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        With crConnectionInfo
            .ServerName = "WWLTDPC"
            'If you are connecting to Oracle there is no
            'DatabaseName. Use an empty string.
            'For example, .DatabaseName = "" 
            .DatabaseName = "CTOMS"
            .UserID = "WWLTDPC\ddlam"
            .Password = "" 
        End With
        'Put user code to initialize the page here
        Dataset21.Clear()
        SqlSelectCommand1.CommandText = "SELECT StudentID, Surname, FirstName, HKID FROM Student"
        SqlDataAdapter1.Fill(Dataset21, "Student")
        crReportDocument.SetDataSource(Dataset21)
        'crReportDocument.Refresh()
        'CrystalReportViewer1.ReportSource = crReportDocument
        'This code works for both user tables and stored
        'procedures. Set the CrTables to the Tables collection
        'of the report
        CrTables = crReportDocument.Database.Tables
        'Loop through each table in the report and apply the
        'LogonInfo information
        For Each CrTable in CrTables
            CrTableLogonInfo = CrTable.LogonInfo
            CrTableLogonInfo.ConnectionInfo = crConnectionInfo
            CrTable.ApplyLogOnInfo(crtableLogoninfo)
            'If your DatabaseName is changing at runtime, specify the table location.
            'For example, when you are reporting off of a
            'Northwind database on SQL server you should have the following line of code:
            'crTable.Location = "Northwind.dbo." & 
            'crTable.Location.Substring(crTable.Location.LastIndexOf(".") + 1)
        Next
        'Set the viewer to the report object to be previewed.
        CrystalReportViewer1.ReportSource = crReportDocument
    End Sub
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
mlmccCommented:
In the code you are passing the logon information.  I suspect this may be overriding the Windows Authentication.

Does the logged in user have database permissions?

mlmcc
0
 
ddlamAuthor Commented:
I think it has. I add user account "WWLTDPC\ddlam" in
Enterprise Manager>Console root>Microsoft Sql server>Local>Login
0
 
cyberdevil67Commented:
When creating a report the username and the servername and passwords get embeded into the report.

When you load the report you can do the following to override the username and password to connect to the database.

Report.SetDatabaseLogon("username", "password")

0
 
ddlamAuthor Commented:
I can do asscess directly after updating window
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 4
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now