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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User Session Has Expired 1

Status
Not open for further replies.

mimpuerto

Programmer
Mar 19, 2003
5
GB
Hello!

I have a problem calling a Crystal Report via ASP. The page was successfully loaded the Crystal Smart Viewer ActiveX. Unfortunately, records were not retrieved and a prompt saying "User Session Has Expired" is visible on my screen.
I am using ADO (Data Definitions Only). During run-time, I set the recordset in replacement for the Data Definitions. My database is a simple Access Database


<%
Set oConn = Server.CreateObject(&quot;ADODB.Connection&quot;)
oConn.Open &quot;File Name=C:\Winnt\UDL1.udl&quot;

set session(&quot;oRs&quot;) = Server.CreateObject(&quot;ADODB.Recordset&quot;)
session(&quot;oRs&quot;).ActiveConnection = oConn
session(&quot;oRs&quot;).Open &quot;SELECT FIELD1, FIELD2 FROM TABLE1&quot;

reportname = &quot;Report1.rpt&quot;

If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;Crystal.CRPE.Application&quot;)
End If

Path = Request.ServerVariables(&quot;PATH_TRANSLATED&quot;)
While (Right(Path, 1) <> &quot;\&quot; And Len(Path) <> 0)
iLen = Len(Path) - 1
Path = Left(Path, iLen)
Wend
If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).OpenReport(path & reportname, 1)

set session(&quot;oRptOptions&quot;) = Session(&quot;oRpt&quot;).Options
session(&quot;oRptOptions&quot;).MorePrintEngineErrorMessages = 0

session(&quot;oRpt&quot;).DiscardSavedData
set Database = session(&quot;oRpt&quot;).Database

set Tables = Database.Tables

set Table1 = Tables.Item(1)

Table1.SetPrivateData 3, session(&quot;oRs&quot;)

On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords
If Err.Number <> 0 Then
Response.Write err.description & &quot; &quot; & err.number
' Response.Write &quot;An Error has occured on the server in attempting to access the data source &quot; & err.number
Else

If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If
%>
<HTML>
<HEAD>
<TITLE>Seagate Crystal Smart Viewer for ActiveX</TITLE>
</HEAD>
<BODY BGCOLOR=C6C6C6 LANGUAGE=VBScript ONLOAD=&quot;Page_Initialize&quot;>

<OBJECT ID=&quot;CRViewer&quot;
CLASSID=&quot;CLSID:C4847596-972C-11D0-9567-00A0C9273C2A&quot;
WIDTH=100% HEIGHT=95%
CODEBASE=&quot;/viewer/activeXViewer/activexviewer.cab#Version=7,0,100,52&quot;>
<PARAM NAME=&quot;EnableRefreshButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;DisplayGroupTree&quot; VALUE=1>
<PARAM NAME=&quot;EnablePrintButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableExportButton&quot; VALUE=1>
<PARAM NAME=&quot;EnableDrillDown&quot; VALUE=1>
<PARAM NAME=&quot;EnableSearchControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableAnimationControl&quot; VALUE=1>
<PARAM NAME=&quot;EnableZoomControl&quot; VALUE=1>
</OBJECT>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!--
Sub Page_Initialize
On Error Resume Next
Dim webBroker
Set webBroker = CreateObject(&quot;WebReportBroker.WebReportBroker&quot;)
if ScriptEngineMajorVersion < 2 then
window.alert &quot;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.&quot;
CRViewer.ReportName = Location.Protocol + &quot;//&quot; + Location.Host +&quot;/scrreports/rptserver.asp&quot;
else
Dim webSource
Set webSource = CreateObject(&quot;WebReportSource.WebReportSource&quot;)
webSource.ReportSource = webBroker
webSource.URL = Location.Protocol + &quot;//&quot; + Location.Host + &quot;/scrreports/rptserver.asp&quot;
webSource.PromptOnRefresh = True
CRViewer.ReportSource = webSource
end if
CRViewer.ViewReport
End Sub
-->
</SCRIPT>

</BODY>
</HTML>


What's wrong with this code? Please help me. ASAP!!!
Thanks a lot![thumbsup2]
 
This is a pretty generic error, but is probably most commonly gotten due to not connecting to the database correctly. Use SetLogonInfo for all your tables (not forgetting any subreports) and try executing your .LogonServer command independently successfully.

If you're still having problems, and are using IIS, this link regarding IIS modifications may be of some use:


Naith
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top