T
Tammy B.
Hiya - Big puzzler for me. Code Below
I create a class. I save it to a session variable.
Then, I retrieve the session variable back into a new local variable.
I am able to use a method which prints the name "Joey."
Works great.
But if I retrieve the same session variable into a local variable from a
different page, I cannot use the method. It fails.
Even though the session variable is an object, and the local variable is an
object!
Why? How can I get to this class from the second page?
thanks
<%
dim oTest
set oTest= new clsEmployee
oTest.EmployeeName="Joey"
set session("sessionTest")= oTest
set oTest= nothing
'This section works fine------------------------------
'But not from another page!
dim oNewTest
set oNewTest = session("sessionTest")
Response.Write "<br>Is oNewTest an object? " & isObject(oNewTest)
Response.Write "<Br>"
Onewtest.PrintEmployeeName
---------------------------------------
Class clsEmployee
Private m_strEmployeeName
Public Property Get EmployeeName
EmployeeName = m_strEmployeeName
End Property
Public Property Let EmployeeName (strEmployeeName)
m_strEmployeeName = strEmployeeName
End Property
Sub PrintEmployeeName
Response.Write EmployeeName
End Sub
End Class
%>
I create a class. I save it to a session variable.
Then, I retrieve the session variable back into a new local variable.
I am able to use a method which prints the name "Joey."
Works great.
But if I retrieve the same session variable into a local variable from a
different page, I cannot use the method. It fails.
Even though the session variable is an object, and the local variable is an
object!
Why? How can I get to this class from the second page?
thanks
<%
dim oTest
set oTest= new clsEmployee
oTest.EmployeeName="Joey"
set session("sessionTest")= oTest
set oTest= nothing
'This section works fine------------------------------
'But not from another page!
dim oNewTest
set oNewTest = session("sessionTest")
Response.Write "<br>Is oNewTest an object? " & isObject(oNewTest)
Response.Write "<Br>"
Onewtest.PrintEmployeeName
---------------------------------------
Class clsEmployee
Private m_strEmployeeName
Public Property Get EmployeeName
EmployeeName = m_strEmployeeName
End Property
Public Property Let EmployeeName (strEmployeeName)
m_strEmployeeName = strEmployeeName
End Property
Sub PrintEmployeeName
Response.Write EmployeeName
End Sub
End Class
%>