how do I change an objects properties when stored as a session

liunx

Guest
Ok I have an employee object that I want to store in a Session variable:

Session("myEmployee") = New myNs.employee()

how do I go about changing the properties or calling methods from this object once its in a Session?


set property guess:
Session("myEmployee").firstName = "Darin"

call method guess:
Session("myEmployee").makeAngry("byPestering")I think you'll have to use DirectCast or CType, so the compiler knows what type of Object you're dealing with.For example:

DirectCast(Session("myEmployee"), myNs.employee).firstName = "Darin"

or

CType(Session("myEmployee"), myNs.employee).firstName = "Darin"
 
Back
Top