Link to home
Start Free TrialLog in
Avatar of sata
sata

asked on

User Session expired

Hi,

I have a set of crystal reports that I need to let the users view on ASP pages. Therefore I used the Crystal Smart Viewer. It has been working well, until recently, about 3 days back, the user keep experiencing "User Session has expired" when trying to retrieve the pages.

I thought that there may be some issues with the database, so I rebooted it, and it works well for a while, before the "User session has expired" thingy turns up again.

If I run the crystal report directly without going through the ASP page, the report can be displayed.

Can someone help me with why and how can I resolve this problem? Thanks!

I'm using Crystal Report 7, MS SQL database.
Avatar of Mike McCracken
Mike McCracken

Avatar of sata

ASKER

We have tried the solutions provided in Crystaldecisions, but still it's not working. I changed the error message, and got the below:

Error returned: 20534 meaning: Error detected by database DLL.

Could the problem be at the database end?
How are you calling the report?

Are you passing the correct logon information?

mlmcc
Avatar of sata

ASKER

Hi,

I include the connection part for one of the reports:

------------------------------------------------------------------

Dim vReportName
vReportName = "Handover Confirmation Report.rpt"
If Not IsObject (Session("oApp")) Then                              
      Set Session("oApp") = Server.CreateObject("Crystal.CRPE.Application")
End If  
Dim vPath, iLen
vPath = Request.ServerVariables("PATH_TRANSLATED")                    
While (Right(vPath, 1) <> "\" And Len(vPath) <> 0)                      
      iLen = Len(vPath) - 1                                                  
      vPath = Left(vPath, iLen)                                              
Wend    

session("oApp").LogonServer "PDSSQL.DLL", CStr(session("strdbServer")), Cstr(session("strdbDatabase")), CStr(session("strdbUserID")) , CStr(session("strdbPassword"))      

Set Session("oRpt") = Session("oApp").OpenReport(vPath & vReportName, 1)
set Session("oRptOptions") = Session("oRpt").Options
Session("oRptOptions").MorePrintEngineErrorMessages = 0

set Session("ParamCollection") = Session("oRpt").Parameterfields        

Dim Param1, Param2, Param3, Param4, Param5, Param6
set Param1 =  Session("ParamCollection").Item(1)
set Param2 =  Session("ParamCollection").Item(2)
set Param3 =  Session("ParamCollection").Item(3)
Dim ParamValue1, ParamValue2, ParamValue3, ParamValue4, ParamValue5, ParamValue6
ParamValue1 = Session("strUserID")
ParamValue2 = Request.Form("select1")
ParamValue3 = Request.Form("select2")

Call Param1.SetCurrentValue (CStr(ParamValue1), 12)
Call Param2.SetCurrentValue (CStr(ParamValue2), 12)
Call Param3.SetCurrentValue (CDbl(ParamValue3), 7)
On Error Resume Next                                                  
      Session("oRpt").ReadRecords                                          
      If Err.Number <> 0 Then                                              
            Response.Write ("Error returned: " & err.number & " meaning: " & err.description)
      Else

            If IsObject (Session("oPageEngine")) Then                              
                  set Session("oPageEngine") = nothing
            end if
            set Session("oPageEngine") = Session("oRpt").PageEngine            
      End If                                                                

      <HTML>
      <HEAD>
      <TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
      </HEAD>
      <BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD="Page_Initialize">
      <OBJECT ID="CRViewer"
            CLASSID="CLSID:C4847596-972C-11D0-9567-00A0C9273C2A"
            WIDTH=100% HEIGHT=95%
                codebase="/viewer/activeXViewer/activexviewer.cab#Version=2,2,4,28">
      <PARAM NAME="EnableRefreshButton" VALUE=1>
      <PARAM NAME="EnableGroupTree" VALUE=0>
      <PARAM NAME="DisplayGroupTree" VALUE=0>
      <PARAM NAME="EnablePrintButton" VALUE=1>
      <PARAM NAME="EnableExportButton" VALUE=1>
      <PARAM NAME="EnableDrillDown" VALUE=1>
      <PARAM NAME="EnableSearchControl" VALUE=1>
      <PARAM NAME="EnableAnimationControl" VALUE=1>
      <PARAM NAME="EnableZoomControl" VALUE=1>
      </OBJECT>

      <SCRIPT LANGUAGE="VBScript">
      <!--
      Sub Page_Initialize
            On Error Resume Next
            Dim webBroker
            Set webBroker = CreateObject("WebReportBroker.WebReportBroker")
            if ScriptEngineMajorVersion < 2 then
                  window.alert "IE 3.02 users on NT4 need to get the latest version of VBScript or install IE 4.01 SP1. IE 3.02 users on Win95 need DCOM95 and latest version of VBScript, or install IE 4.01 SP1. These files are available at Microsoft's web site."
                  CRViewer.ReportName = Location.Protocol + "//" + Location.Host +"/scrreports/rptserver.asp"
            else
                  Dim webSource
                  Set webSource = CreateObject("WebReportSource.WebReportSource")
                  webSource.ReportSource = webBroker
                  webSource.URL = Location.Protocol + "//" + Location.Host + "/scrreports/rptserver.asp"
                  webSource.PromptOnRefresh = True
                  CRViewer.ReportSource = webSource
            end if
            CRViewer.ViewReport
      
      End Sub
      -->
      </SCRIPT>

      </BODY>
      </HTML>
      
<%End If%>

<%
Set objCatRecord = Nothing
Set objCatResponse = Nothing
Set objCat = Nothing
%>
One of the causes of the 20534 is invalid logon information

session("oApp").LogonServer "PDSSQL.DLL", CStr(session("strdbServer")), Cstr(session("strdbDatabase")), CStr(session("strdbUserID")) , CStr(session("strdbPassword"))

I don't know ASP that well but is SESSION needed before each string?
Is it retrieving the correct information?

mlmcc
Avatar of sata

ASKER

Hi,

I don't know ASP that well either, so I can't comment why is "session" required. :(  I inherited this set of codes.
The codes have been running well for 2 years, so I don't think it's likely that it suddenly pick up the wrong values. Anyway, I need try hardcoding the values into:

session("oApp").LogonServer "PDSSQL.DLL", "servername", "dbname", "user", "userpasswd"
(assuming the above are my actual values.)

But the error still occurs.

The interesting thing is, once I reboot my app server and database server, it will run for sometime, and after a while, stop working...
I don't know.  The only thing that makes any sense is that you aren't releasing the sessioin when a report closes.

mlmcc
Avatar of sata

ASKER

so is this wrong or right?

do you think the dll is corrupted?
Could be but I doubt it.  Has anything changed on your network?

mlmcc
Avatar of sata

ASKER

No, nothing change in the network. I have checked again and again with the network guys.

Is there a way to check if the login is working fine? Anyway to establish that without using the report?
Are you using IIS?  You may need to verify that Session State is enabled in the IIS properties
Avatar of sata

ASKER

I have tried all means, but doesn't seems to be able to get the crystal report back to a stable state. At times it's just go abnormal, at times it's ok.

Is there any other possible solution to this? If not, I guess I just have to close this question....
ASKER CERTIFIED SOLUTION
Avatar of PashaMod
PashaMod

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial