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!

not releasing Licenses via web reports

Status
Not open for further replies.

wk6pack

Programmer
Jan 17, 2003
6
CA
Hi,

I am developing a web application using Crystal reports and ASP. I use the examples that Crystal provided but I came across a problem.

When I use the following code, it doesnt seem to release the license in my session. It only releases it after I logout and then come back in. I can see the license released but not during the session the user gets the error.

Does anyone have a solution to this or encountered something like this before?? I'm using CR8.5 developer with W2K and IE 6

Here is the code:
'OPEN THE REPORT (but destroy any previous one first)

If IsObject(session("oRpt")) then
Set session("oRpt") = nothing
End if

'Once an error hits, the program doesnt execute past this until they log out and come back in.
'This detects the number of licenses available to run the reports.
blsActive = Session("oApp").GetLicenseStatus(nLicensed, nActive)
if blsActive=false then
Set Session("oRpt") = nothing
Set Session("oApp") = nothing
'response.write(&quot;<!-- <form>&quot;)
'response.write(&quot;<input type=button value='Close Window' onClick=&quot;&quot;javascript:window.close();&quot;&quot;>&quot;)
'response.write(&quot;</form> -->&quot;)
response.write(&quot;<BODY BGCOLOR=C6C6C6 ONUNLOAD=&quot;&quot;CallDestroy();&quot;&quot; topmargin=0 leftmargin=0>&quot;)
'response.write(&quot;<a href=&quot;&quot;menu.asp&quot;&quot; onClick=&quot;&quot;javascript:window.close();&quot;&quot;><img src=&quot;&quot;graphics/mmenu.gif&quot;&quot; width='133' height='44' alt='back to main menu' border='0'></a>&quot;)
Response.write(&quot;There are currently 5 users accessing the reports. Please try again later<br>&quot;)
'Response.write(&quot;You will be redirected to the menu page.&quot;)
'Response.write(&quot;<meta http-equiv=&quot;&quot;refresh&quot;&quot; content=&quot;&quot;4;url=menu.asp&quot;&quot;/></head><br>&quot;)
response.write(&quot;<script language='javascript'>&quot;)
response.write(&quot;function CallDestroy()&quot;)
response.write(&quot;{&quot;)
response.write(&quot; window.open(&quot;&quot;Cleanup.asp&quot;&quot;,&quot;&quot;Cleanup&quot;&quot;,&quot;&quot;status=yes,toolbar=yes,location=no,menu=yes,scrollbars=yes&quot;&quot;);&quot;) ',width=1,height=1
response.write(&quot; self.focus()&quot;)
response.write(&quot;}&quot;)
response.write(&quot;</script></body>&quot;)
Response.End
end if

Thanks for you help,
Will
 
u need to go inside cleanup.asp to release licenses, it has a bug inside, you can look at into it. I didn't spend much time on it because we decide use Crystal Enterprise later on.

Hope it helps !

Ted
 
Hi Ted,

I have been looking at cleanup.asp.

The code is:
Function DestroyObjects(ByRef ObjectToDestroy)
If isobject(ObjectToDestroy) then
set ObjectToDestroy = nothing
DestroyObjects = true
Else
DestroyObjects = false
End if
End Function

'This function takes an object (by reference rather than by value) and destroys it.
'If the object was destroyed we return true otherwise we return false.

If DestroyObjects(session(&quot;oPageEngine&quot;)) then
Response.Write(&quot;Page Engine Object Destroyed&quot; & &quot;<BR>&quot;)
Else
Response.Write(&quot;Page Engine Object not in Scope&quot; & &quot;<BR>&quot;)
End If

If DestroyObjects(session(&quot;oRpt&quot;)) then
Response.Write(&quot;Report Object Destroyed&quot; & &quot;<BR>&quot;)
Else
Response.Write(&quot;Report Object not in Scope&quot; & &quot;<BR>&quot;)
End If

If DestroyObjects(session(&quot;oApp&quot;)) then
Response.Write(&quot;Application Object Destroyed&quot; & &quot;<BR>&quot;)
Else
Response.Write(&quot;Application Object not in Scope&quot; & &quot;<BR>&quot;)
End If

'This series of If...Then...Else loops calls the DestroyObjects function
'for each of the three main objects used in Crystal Reports ASP pages.
%>
<SCRIPT LANGUAGE=&quot;Javascript&quot;>

function CallClose()
{
window.close();
}
</SCRIPT>
</BODY>
</HTML>
<%
'The javascript code is used to close the newly opened browser window once the page has run
'Session.Abandon
Response.End
'These last two lines terminate that user's active session and flushes html to the browser.
%>


I dont want to use the session.abandon because that will clear out all my session variables I have set. I just need to have the license released. When I go to the server, it does release the license but the user session doesnt see to pick that up.

thanks,
Will
 
If you are using ASP2.0 with IIS 4.0 on NT sever 4.0, you have no way to remvoe it seperately as far as I know, unless you update to IIS 5.0 with Windows 2000 or higher. they have session.item(&quot;sessionname&quot;).remove.

We are using NT Server, it was really terrible for us too.
Another thing is 5 concurrent user limitation. These are the reasons why we move to Crystal Enterprise.

Ted
 
I will give that a try. We are on W2K and IIS 5.0.

Unfortunately, CE license is way too expensive for a school district.

I'll let you know what happens.

thanks,
Will
 
We had that problem at my previous company, and this is how we solved it:

Use cleanup.asp, but remove the session.abandon line. Make sure that ALL the report objects you created are destroyed (subreports, parameters, etc) because if you just destroy the oPageEngine, oApp and oRpt, it will NOT release the license.

Hope that helps!

Marie
 
Hi Marie,

Could you tell me why if you destroy the objects, it doesnt release the license? I do see the license get release because there is a tool on the server call RDC Runtime License Status. It shows 5 then it shows 4.

I think somewhere on the AlwaysRequiredSteps.asp file that is in memeory or buffer.

Here is my code:
' CREATE THE APPLICATION OBJECT
If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.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

On error resume next

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

************************THIS LINE HERE
blsActive = Session(&quot;oApp&quot;).GetLicenseStatus(nLicensed, nActive)
if blsActive=false then
'Set Session(&quot;oRpt&quot;) = nothing
'Set Session(&quot;oApp&quot;) = nothing
session.item(&quot;oRpt&quot;).remove
session.item(&quot;oApp&quot;).remove
'response.write(&quot;<!-- <form>&quot;)
'response.write(&quot;<input type=button value='Close Window' onClick=&quot;&quot;javascript:window.close();&quot;&quot;>&quot;)
'response.write(&quot;</form> -->&quot;)
response.write(&quot;<BODY BGCOLOR=C6C6C6 ONUNLOAD=&quot;&quot;CallDestroy();&quot;&quot; topmargin=0 leftmargin=0>&quot;)
'response.write(&quot;<a href=&quot;&quot;menu.asp&quot;&quot; onClick=&quot;&quot;javascript:window.close();&quot;&quot;><img src=&quot;&quot;graphics/mmenu.gif&quot;&quot; width='133' height='44' alt='back to main menu' border='0'></a>&quot;)
Response.write(&quot;There are currently 5 users accessing the reports. Please try logging on again later.<br>&quot;)
'Response.write(&quot;You will be redirected to the menu page.&quot;)
'Response.write(&quot;<meta http-equiv=&quot;&quot;refresh&quot;&quot; content=&quot;&quot;4;url=menu.asp&quot;&quot;/></head><br>&quot;)
response.write(&quot;<script language='javascript'>&quot;)
response.write(&quot;function CallDestroy()&quot;)
response.write(&quot;{&quot;)
response.write(&quot; window.open(&quot;&quot;Cleanup.asp&quot;&quot;,&quot;&quot;Cleanup&quot;&quot;,&quot;&quot;status=yes,toolbar=yes,location=no,menu=yes,scrollbars=yes&quot;&quot;);&quot;) ',width=1,height=1
response.write(&quot; self.focus()&quot;)
response.write(&quot;}&quot;)
response.write(&quot;</script></body>&quot;)

Response.End
end if

Could you tell me where ****THIS LINE should go??

thanks,
Will
 
If you do not create any additional report objects such as parameters on your ASP code, then the code on cleanup.asp should work for you. Just delete the session.abandon line.

Our problem was that we used a generic ASP page for the creation of report. Some reports were using parameters, and some weren't. If we didn't destroy the parameter objects created on the ASP, the license was not released. So all report objects created in your ASP code must be destroyed for the licence to be released.
 
Thanks,

I do have reports that use user input parameters. I'll give it a try.

Will
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top