I have a webapp in ASP.Net with a VB codebehind. I need a List variable I have declared to persist as long as the person is on the page, but currently any time a control posts back to the code, everything is cleared out. I am completely new to ASP.net, so I have no idea if this is even possible. Can it be done with a Session variable? Those seem to me to be limited to base types, but I could be wrong.
I have a webapp in ASP.Net with a VB codebehind. I need a List
Share
With ASP.Net it is creating a new instance of your Code Behind class each time the page loads, which is why your class-level variables are being reset.
Your best option is probably to store the List you are wanting to hold on to in the Session. If it would make things easier you can create a getter for the list that reads the data from the session variable. In C# it would look like: