Link to home
Start Free TrialLog in
Avatar of SysCapstone
SysCapstone

asked on

Displaying a session variable created in VBScript in a Javascript platform.


Hi,

We have created a global.asa file that contains a variety of session variables that we use for this ASP.Net application.
Here is the relevant code for the global.asa page.

<script language="vbscript" runat="server">

sub Session_OnStart
            
      session("count") = 0
end sub
      
</script>

There is extra code within the code, but the key point is that it is in VBScript and needs to stay in VBScript.

session("count"), however, needs to be able to be written on a Javascript page.

The javascript page is automatically generated from a Manifold GIS application and needs to remain in Javascript.
We need to be able to Response.Write the session("count") variable on the page. However, because the
session varibale was created in a VBScript, we cannot write it on the page. We have attempted to add a VBScript section to the page to write this variable but this does not work. Here is an excerpt from the code that we think should work, but does not.

<%@ enablesessionstate=false language=javascript %>
<%

JAVASCRIPT............

%>

<script language=vbscript>

Response.Write session("count")

</script>

The page displays fine, but the vbscript does not execute at all. On other pages, that are initialized with vbscript, the session variable works the way it should so we know it is not a problem with the session variable. How can we fix this problem?

Thanks.

Avatar of QPR
QPR
Flag of New Zealand image

Try

<script language="Javascript">
<%=session("count")%>
</script>
ASKER CERTIFIED SOLUTION
Avatar of bsdotnet
bsdotnet

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
OOps yes, BSDOTNET is correct - I forgot the document.write bit
SOLUTION
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