Home All Groups Group Topic Archive Search About

ASP problem: is this a bug in VBScript?

Author
3 May 2010 1:02 PM
Jеns Mаrtin Schlаttеr
I'm running a web server with vbscript 5.8

I have the following problem: I define a class, put the instances into
an array, and write this array into the Session instance.
When getting back the array, there are still objects in it, but
VBScript seems to forget the type of object.
Is this a bug in the object serialisation?

The code is:

<%@ LANGUAGE="VBSCRIPT" %>
<%  OPTION EXPLICIT
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body>
<%
class test
  public txt
end class

dim t
t=array()
if isEmpty(Session("tst")) then
        dim tObj:set tObj=new test
        tObj.txt="1234"
        redim preserve t(10)
        set t(0)=tObj
      Session("tst") = t
else
  t = Session("tst")
  response.write("from session<br>")
end if

response.write(" "&t(0).txt)

      %>

</body>
</html>

You have to reload the page to see the problem.

Martin Schlatter

Author
3 May 2010 4:14 PM
Nobody
You need to ask your question in a group with "asp" in the name. VB.Net is
not compatible with VBScript, it uses the extension ASPX to differentiate
from classic ASP.

news://msnews.microsoft.com/microsoft.public.inetserver.asp.general
news://msnews.microsoft.com/microsoft.public.scripting.vbscript
Author
3 May 2010 6:22 PM
Michel Posseth [MCP]
Show quote Hide quote
"J?ns M?rtin Schl?tt?r" <KrnBibJtuEsl@spammotel.com> schreef in bericht
news:323bcc54-8def-4bec-bb12-31b585afc29a@d39g2000yqa.googlegroups.com...
> I'm running a web server with vbscript 5.8
>
> I have the following problem: I define a class, put the instances into
> an array, and write this array into the Session instance.
> When getting back the array, there are still objects in it, but
> VBScript seems to forget the type of object.
> Is this a bug in the object serialisation?
>
> The code is:
>
> <%@ LANGUAGE="VBSCRIPT" %>
> <%  OPTION EXPLICIT
> %>
> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
> <html>
> <head>
> </head>
> <body>
> <%
> class test
>  public txt
> end class
>
> dim t
> t=array()
> if isEmpty(Session("tst")) then
>     dim tObj:set tObj=new test
>     tObj.txt="1234"
>     redim preserve t(10)
>     set t(0)=tObj
>   Session("tst") = t
> else
>  t = Session("tst")
>  response.write("from session<br>")
> end if
>
> response.write(" "&t(0).txt)
>
>      %>
>
> </body>
> </html>
>
> You have to reload the page to see the problem.
>
> Martin Schlatter
>

<%@ LANGUAGE="VBSCRIPT" %>
<%  OPTION EXPLICIT
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
</head>
<body>
<%
class test
  public txt
end class

dim t
t=array()
if isEmpty(Session("tst")) then
    dim tObj:set tObj=new test
    tObj.txt="1234"
    redim preserve t(10)
    set t(0)=tObj
  Session("tst") = t
else
  t = Session("tst")

response.write("from session<br>")
end if

Dim objP as test
Set objP=t(0)

response.write(" "& objP.txt)

      %>

</body>
</html>


HTH

Michel