在会话对象经典ASP库对象

问题描述:

我是新来的传统的ASP,我需要code的Web应用程序在传统的ASP因为客户希望它是在传统的ASP。 (

I am new to classic ASP and I need to code a web application in classic asp because the customer wants it to be in classic asp. :(

不管怎么说!这里是我的问题:

Anyways! here is my question:

当我有一个类叫做人的对象:

When I have a object of a class called person:

Class Person
 Private m_sFirstName

 Public Property Get firstName
 firstName = m_sFirstName
 End Property

 Public Property Let firstName(value)
   m_sFirstName = value
 End Property

End Class


set aPerson = new Person
Person.firstName = "Danny"

set Session("somePerson") = aPerson



到目前为止好...

在接下来的要求,我试着念想了会议VAR:

On the next request , I try to read the session var like :

If IsObject(Session("aPerson")) = true Then
    set mySessionPerson = Session("aPerson")

      Response.Write(TypeName(myTest)) // will output "Person" 
      Response.Write(mySessionPerson.firstName) // will output "Object doesn't support this property or method: 'mySessionPerson.firstName'
End If

关于正在发生的事情将会有很大的帮助任何想法。

Any ideas about what is going would be of great help.

这是因为在ASP经典的对象不能序列化。

This is because objects in ASP Classic are not serializable.

下面是一个方法的文章,以模拟ASP经典序列化对象。

Here is an article on a way to simulate serializing objects in ASP Classic.

http://decav.com/blogs/andre/存档/ 2007/02/12 / 1073.aspx

看大约一半在页面保存ASP VBScript的对象到会话。

Look at Saving ASP VBScript "Objects" to Session about half way down the page.