title: Can you assign objects to Session in the ASP.NET C# Page_Unload method?
body: <p>I am creating an ASP.NET application (using C# as the server scripting language), and need to use Session to retain data between postbacks. I am using an UpdatePanel and will have lists of textboxes etc. which are changed on the fly. These lists will be global to the code behind class. When the page posts back I will need to save the changes to these lists (and other global class variables) and so will need to save them to session. I know that lists are stored in memory and so don't actually need to be stored in session, but please ignore this fact; I am just testing the idea :P. Can it be done, and is it good programming practice if it can, to write everything to Session in the <code>Page_Unload(object sender, EventArgs e)</code> method of the code behind?</p>