M
mark_drewersback
I've been developing in .net for approx 6 months now and would like an
opinion on whether it is ok to use session to store objects?
I normally create a property such as below in code behind on every page
that will use the object.
Public Property Environment() As bsEnvironment
Get
Return CType(Session("Environment"), bsEnvironment)
End Get
Set(ByVal Value As bsEnvironment)
Session("Environment") = Value
End Set
End Property
To populate properties I would use:
Dim environment As New bsEnvironment()
environment.Background = "White"
environment.Foreground = "Black"
Session("environment") = environment
On my other pages I would just access the object using
Environment.Background etc..
Is this the correct way to have objects available to many pages? Back
in the asp days I remember that using session to store objects was
advised against. Are things different now with .net?
Opinions valued.
Regards
opinion on whether it is ok to use session to store objects?
I normally create a property such as below in code behind on every page
that will use the object.
Public Property Environment() As bsEnvironment
Get
Return CType(Session("Environment"), bsEnvironment)
End Get
Set(ByVal Value As bsEnvironment)
Session("Environment") = Value
End Set
End Property
To populate properties I would use:
Dim environment As New bsEnvironment()
environment.Background = "White"
environment.Foreground = "Black"
Session("environment") = environment
On my other pages I would just access the object using
Environment.Background etc..
Is this the correct way to have objects available to many pages? Back
in the asp days I remember that using session to store objects was
advised against. Are things different now with .net?
Opinions valued.
Regards