Necesito Ayuda (Dictionary - Classes y Session)

manguiasp
27 de Abril del 2004
Hola a Todos, estoy creando una aplicacion y tengo definida una clase llamada PMItem en el archivo PMItem.asp.

esta es la clase

Class PMItem
Private numero
Private material
Private cantidad
Private unidad
Private fecha_en_obra
Private tipo
Private valor
Private especificacion
public id

Private Sub Class_Initialize
numero = 0
material = ""
cantidad = 0
unidad = "UN"
fecha_en_obra = Date
tipo = 1
valor = 0
especificacion = ""
id = "PMITEM"
End Sub

Public Property Get ItemNumero
ItemNumero = numero
End Property

Public Property Get ItemMaterial
ItemMaterial = material
End Property

Public Property Get ItemCantidad
ItemCantidad = cantidad
End Property

Public Property Get ItemUnidad
ItemUnidad = unidad
End Property

Public Property Get ItemFecha
ItemFecha = fecha_en_obra
End Property

Public Property Get ItemTipo
ItemTipo = tipo
End Property

Public Property Get ItemValor
Itemvalor = valor
End Property

Public Property Get ItemEspecificacion
ItemEspecificacion = especificacion
End Property

Public Property Let ItemNumero(n)
numero = n
End Property

Public Property Let ItemMaterial(m)
material = m
End Property

Public Property Let ItemCantidad(c)
cantidad = c
End Property

Public Property Let ItemUnidad(u)
unidad = u
End Property

Public Property Let ItemFecha(f)
fecha_en_obra = f
End Property

Public Property Let ItemValor(v)
valor = v
End property

Public Property Let ItemTipo(t)
tipo = t
End Property

Public Property Let ItemEspecificacion(e)
especificacion = e
End Property

End Class

en el objeto sesion guardo un objeto Dictionary, cuya clave es un numero y el item respectivo es un objeto del tipo PMItem

<!-- Pagina prueba.asp -->

<%
Set PItem = New PMItem
PItem.ItemMaterial = "Clavos"
Set dict = CreateObject("Scripting.Dictionary")
dict.add 1,PItem
Set Session("temp") = dict
%>

y hago un enlace a la pagina prueba2.asp cuyo codigo asp es el siguiente


<%
val = 0
Dim mitem
if IsObject(Session("temp")) then
val = 1
end if
Set mdic = Session("temp")
<%
For Each key in mdic.keys
tt = 0
if (IsObject(mdic.Item(key))) then
tt = 1
end if
Set mitem = mdic.Item(key)

%>
Key <%=key%> - Es Objeto <%= tt %> - Variable Tipo <%=VarType(mitem)%> Nombre <%= TypeName(mitem)%>
<br>
<%=mitem.ItemMaterial%>

<%
Next
%>


Esto deberia funcionar pero sale un error en la parte

<%=mitem.ItemMaterial%>

diciendo que el objeto no acepta esta propiedad, sin embargo si le quito esa parte me imprime con la funcion TypeName que el objeto mitem es d la clase PMItem.

La verdad no entiendo que pasa, cualquier ayuda sera muy agradecida