Accessing Strongly Typed Session Data
I have your Professional ASP.NET 2.0 book. Very nice. I am implementing a StateServer to manage session data. I used your samples in the book as a model, but all data stored was string data. My implementation stores int data. Everything has compiled, and I can assign int values to the Session data, but I can't seem to format the syntax appropriately to extract it. The following forms give "Specified cast not valid":
int foo = (int)Session["openproject"];
or
int foo = Convert.Int32(Session["openproject"].ToString());
I have implemented a serializable class with private "int" variables for the session object. Help!
Tom
|