I don't know the exact situation you are in but what you say is correct - Page + IRequiresSessionState = Session Available. Here is what you do. First define a base class for your pages which will receive session state:
public class BasePage : Page, IRequiresSessionState
{
}
Then in your NoCompile Page you do the following declaration:
<%@ Page Language="C#" CompilationMode="Never" Inherits="BasePage" %>
Works as expected. Session state is available. Now little more about your second question: "Conceptually, why should these be disjoint??". By default the Page
public class Page : TemplateControl, IHttpHandler
{
}
class doesn't implement IRequiresSessionState and thus have no session state. What ASP.NET does for you is compiling a class for you at runtime through which it provides the session - i.e. if I define a page called Default.aspx, with code behind class that implements Page, nowhere I explicitly implement IRequiresSessionState. But ASP.NET compiles ours Default.aspx UI into a class called:
public class default_aspx : Default, IRequiresSessionState, IHttpHandler
{
}
which now explicitly says that it wants session state to be delivered. This is because "EnbaleSessionState" in the @Page directive is by default set to True. Now when you say that default.aspx is a non compile unit by specifying CompilationMode="Never"
, then this class is never generated and you never get the Session State, which makes the use of "EnbaleSessionState" not meaningful and thus disabled.