faqts : Computers : Programming : Languages : Asp : ASP/VBScript

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

36 of 83 people (43%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

Using Server.CreateObject or Session variables from within a function in VBScript gives Error

Mar 12th, 2003 13:07
Chris White, Manjula S,


VBScript that runs at the client end does not have access to the ASP 
Objects 'Server' and 'Session'. Therefore the VBScript generates an 
error that it cannot find the Server and Session Object.
to make session variables available to client at runtime in VBScript 
add a line such as
<Script>
Dim myvar = <%=Session("myvar")%>
</Script>
within the Head tags of the HTML page, and other VBScript within the 
page can now read the myvar variable, but any changes to myvar will 
not be saved to the Session object bask on the server, unless they are 
passed in a form or via the query string back to the server.



© 1999-2004 Synop Pty Ltd