Implementation of the 2.0 session state model
[mono.git] / mcs / class / System.Web / System.Web.SessionState / SessionStateModule.cs
index 5ffee07b5a2cacf28d340306118e318ebccd26ce..1deb4fb1adc707e1638df800ba57bab1481f4fb4 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
@@ -29,6 +29,8 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !NET_2_0
+using System.Web.Configuration;
 using System.Web.Caching;
 using System.Web.Util;
 using System.Security.Cryptography;
@@ -40,12 +42,12 @@ 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                
-               static private SessionConfig config {
+static private SessionConfig config {
                        get {
                                return (SessionConfig)AppDomain.CurrentDomain.GetData("SessionStateModule.config");
                        }
@@ -221,8 +223,10 @@ namespace System.Web.SessionState
 
                internal void OnSessionRemoved (string key, object value, CacheItemRemovedReason reason)
                {
+                       SessionConfig cfg = GetConfig ();
+
                        // Only invoked for InProc (see msdn2 docs on SessionStateModule.End)
-                       if (GetConfig ().Mode == SessionStateMode.InProc)
+                       if (cfg.Mode == SessionStateMode.InProc)
                                HttpApplicationFactory.InvokeSessionEnd (value);
                }
                
@@ -233,3 +237,4 @@ namespace System.Web.SessionState
        }
 }
 
+#endif