New test.
[mono.git] / mcs / class / System.Web / System.Web.SessionState / SessionStateModule.cs
index 7e6b1ca9e9b1329fc290817bff1c7a3b7de3de1d..166299662f95382bb4c773ac72b8f2884492a8ab 100644 (file)
@@ -3,11 +3,11 @@
 //
 // Authors:
 //     Gonzalo Paniagua Javier (gonzalo@ximian.com)
-//     Stefan Görling (stefan@gorling.se)
+//     Stefan Görling (stefan@gorling.se)
 //     Jackson Harper (jackson@ximian.com)
 //
-// Copyright (C) 2002,2003,2004,2005 Novell, Inc (http://www.novell.com)
-// (C) 2003 Stefan Görling (http://www.gorling.se)
+// Copyright (C) 2002-2006 Novell, Inc (http://www.novell.com)
+// (C) 2003 Stefan Görling (http://www.gorling.se)
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the
@@ -42,11 +42,34 @@ namespace System.Web.SessionState
        [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
        public sealed class SessionStateModule : IHttpModule
        {
-               internal static readonly string CookieName = "ASPSESSION";
-               internal static readonly string HeaderName = "AspFilterSessionId";
+               internal const string CookieName = "ASPSESSION";
+               internal const string HeaderName = "AspFilterSessionId";
                static object locker = new object ();
                
 #if TARGET_J2EE                
+#if NET_2_0
+               static private SessionStateSection config {
+                       get
+                       {
+                               return (SessionStateSection) AppDomain.CurrentDomain.GetData ("SessionStateModule.config");
+                       }
+                       set
+                       {
+                               AppDomain.CurrentDomain.SetData ("SessionStateModule.config", value);
+                       }
+               }
+               static private Type handlerType
+               {
+                       get
+                       {
+                               return (Type) AppDomain.CurrentDomain.GetData ("SessionStateModule.handlerType");
+                       }
+                       set
+                       {
+                               AppDomain.CurrentDomain.SetData ("SessionStateModule.handlerType", value);
+                       }
+               }
+#else
                static private SessionConfig config {
                        get {
                                return (SessionConfig)AppDomain.CurrentDomain.GetData("SessionStateModule.config");
@@ -63,8 +86,9 @@ namespace System.Web.SessionState
                                AppDomain.CurrentDomain.SetData("SessionStateModule.handlerType", value);
                        }
                }
+#endif
 #else
-#if CONFIGURATION_2_0
+#if NET_2_0
                static SessionStateSection config;
 #else
                static SessionConfig config;
@@ -91,7 +115,7 @@ namespace System.Web.SessionState
                        handler.Dispose();
                }
 
-#if CONFIGURATION_2_0
+#if NET_2_0
                SessionStateSection GetConfig ()
 #else
                SessionConfig GetConfig ()
@@ -101,7 +125,7 @@ namespace System.Web.SessionState
                                if (config != null)
                                        return config;
 
-#if CONFIGURATION_2_0
+#if NET_2_0
                                config = (SessionStateSection) WebConfigurationManager.GetSection ("system.web/sessionState");
 #else
                                config = (SessionConfig) HttpContext.GetAppConfig ("system.web/sessionState");
@@ -130,7 +154,7 @@ namespace System.Web.SessionState
                public void Init (HttpApplication app)
                {
                        sessionForStaticFiles = (Environment.GetEnvironmentVariable ("MONO_XSP_STATIC_SESSION") != null);
-#if CONFIGURATION_2_0
+#if NET_2_0
                        SessionStateSection cfg = GetConfig ();
 #else
                        SessionConfig cfg = GetConfig ();
@@ -239,7 +263,7 @@ namespace System.Web.SessionState
 
                internal void OnSessionRemoved (string key, object value, CacheItemRemovedReason reason)
                {
-#if CONFIGURATION_2_0
+#if NET_2_0
                        SessionStateSection cfg = GetConfig ();
 #else
                        SessionConfig cfg = GetConfig ();