You say "I have my C# class inheriting the System.Web.UI.Page". That statement makes me think that you are trying to use a class derived from System.Web.UI.Page as a utility class. Is this the case? If so, please read on for the explanation as to why you are experiencing problems.
While you can *technically* create a class derived from the ASP.NET base class, you are not going to get the behavior that you expect. The class is derived from the page class, but it's not going to behave like a regular ASP.NET page will when you use it (that is, when the page is loaded by the web server).
A page class in a web application (the class that drives the *.ASPX page) is loaded by the ASP.NET process and many things happen to it. One of those things is the loading of the page's session information. So while your class (derived from the Page class) HAS a session object on it, it's not going to contain anything like you would expect.
If you want to create a utility class that uses page session information, I'd recommend adding a class scope Session class instance, and passing the active page session into it when you create an instance of the utility class. Then you can use the session data in the utility class as you would from the page class code.
An alternative is to use the current HttpContext instance. "System.Web.HttpContext.Current" will give you the http execution context of the current page request. Off of that you can use the ".Session" property.
-
Peter