I'm getting a strange exception in ASP.NET web app relating to the session state. NOTE: The code was produced by a 3rd party....
Basically I'm getting an HttpException with a description of:
Session state can only be used when enableSessionState is set to true, either in a configuration file or in the Page directive. Please also make sure that System.Web.SessionStateModule or a custom session state module is included in the \\ section in the application configuration.
The code where the failure occurs looks like so:
public class ExtendedWebPage : System.Web.UI.Page
{
protected override void OnInit(EventArgs e)
{
base.OnInit(e);
if (Context.Session != null)
{
if (Session.IsNewSession || Session["UserID"] == null) <--- Errors Here
{
I'm getting the exception on the test of the if statement, however when I interrogate Context.Session its fine. Up to this point the browser has passed through a Login page which was fine and setup some Session variables which I can see Context.Session, however this.Session is throwing the exeption.
Any ideas?
Thanks,
Philip