ASP.NET: Is it possible to keep complex object such as List<object>
is the session? If yes, how to do so? I'm trying to keep a list in the session, but I'm being told that I cannot convert that List to a string.
EDIT
[Serializable]
public class Client
{
public string ClientType { get; set; }
public string ClientName { get; set; }
public string SubClientName { get; set; }
public string Project { get; set; }
public string Service { get; set; }
public string Activity { get; set; }
}
List<Client> ListOfClients;
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
ListOfClients = new List<Client> { new Client()};
Session["ListOfClients"] = ListOfClients;//This is where the error occurs
//Cannot convert List<Client> to string...
}
}
There are many operations to execute, but the idea is to keep whatever is in the list of clients in the session.
Thanks for helping.