Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problems with report .NeedsLogon (CE9 & ASP.Net)

Status
Not open for further replies.

KenpoMatt

Programmer
Aug 22, 2003
2
US
I have published a report to CE9. I am able to use VB.Net to get the latest instance of the report. Now, I want to view the report's chart in a report part viewer on a web page.

The problem is that I keep getting an exception,
"The Enterprise logon failed". I KNOW that I am able to logon to CE9. That is how I get the report instance. But, the report instance's .NeedsLogon returns True.

The database logon info is stored in CE9. I can go to the CE9 administrator, click "Run Now" and it works without prompting me for logon info.

My code seems to blow up when I set the report viewer's .ReportSource to the instance of the report I fetched from CE9.

Does anyone know why I'm getting this exception? Any help is greatly appreciated.

Here is my code:
Code:
Dim ceSessionmgr As New SessionMgr
Dim ceSession As EnterpriseSession
Dim ceInfoStore As InfoStore
Dim ceEnterpriseService As EnterpriseService

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  LogOn("myusername", "mypassword", "myaps", "secEnterprise")
  
  Dim oRpt As Report = getReport()
  If Not IsPostBack Then
    Dim crReportPartsDefinition As New CrystalDecisions.Web.ReportPartsDefinition
    With CrystalReportPartsViewer1
      .ReportParts = crReportPartsDefinition
      .ReportSource = oRpt
    End With
  End If
End Sub

Private Sub LogOn(ByVal p_user As String, ByVal p_password As String, ByVal p_aps As String, ByVal p_auth As String)
  If TypeOf Session.Item("CEInfoStore") Is Object Then
    ceInfoStore = Session.Item("CEInfoStore")
  Else
    ceSession = ceSessionmgr.Logon(p_user, p_password, p_aps, p_auth)
    ceEnterpriseService = ceSession.GetService("", "InfoStore")
    ceInfoStore = New InfoStore(ceEnterpriseService)
    Session.Add("CEInfoStore", ceInfoStore)
   End If 
nd Sub

Public Function getReport() As Report
  Dim result = ceInfoStore.Query("SELECT * FROM CI_INFOOBJECTS WHERE SI_ID = 77222")
  Return result.Item(1)
End Function
 
Hey, I managed to figure this one out on my own. I'll post my findings just incase you ever run into this problem. I did log onto CE correctly when I fetched the report. The reason I was prompted for a logon is b/c the report part viewer requires logon credentials. The viewer has a property called
Code:
CrystalReportPartsViewer1.EnterpriseLogon
. I just created a SessionMgr object and set
Code:
CrystalReportPartsViewer1.EnterpriseLogon = SessionMgr.Logon
. Ta-da, it worked
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top