I am trying to create a property in a class like so
Public Shared Property OrderList() As ArrayList
Get
If System.Web.HttpContext.Current.Session("IsOrder") Is Nothing Then
Return System.Web.HttpContext.Current.Session("IsOrder")
End If
End Get
Set(ByVal Value As ArrayList)
System.Web.HttpContext.Current.Session("IsOrder") = Value
End Set
End Property
This always errors with an System.NullReferenceException.
My question is how do i set this session variable to stop it falling over? If i do System.Web.HttpContext.Current.Session("IsOrder") = new ArrayList or System.Web.HttpContext.Current.Session("IsOrder") = "test" it still errors and says the object does not exist!
I have tried other ways including trying to set the value in the new() but these fail. Am i missing something really obvious about setting session variables in a class?
Please help!
Public Shared Property OrderList() As ArrayList
Get
If System.Web.HttpContext.Current.Session("IsOrder") Is Nothing Then
Return System.Web.HttpContext.Current.Session("IsOrder")
End If
End Get
Set(ByVal Value As ArrayList)
System.Web.HttpContext.Current.Session("IsOrder") = Value
End Set
End Property
This always errors with an System.NullReferenceException.
My question is how do i set this session variable to stop it falling over? If i do System.Web.HttpContext.Current.Session("IsOrder") = new ArrayList or System.Web.HttpContext.Current.Session("IsOrder") = "test" it still errors and says the object does not exist!
I have tried other ways including trying to set the value in the new() but these fail. Am i missing something really obvious about setting session variables in a class?
Please help!