* SessionInProcHandler.cs: Use AppDomain.SetData so data is
authorJackson Harper <jackson@novell.com>
Thu, 13 Nov 2003 23:02:38 +0000 (23:02 -0000)
committerJackson Harper <jackson@novell.com>
Thu, 13 Nov 2003 23:02:38 +0000 (23:02 -0000)
available across all threads. Set the path of session id
cookies. Patch by Mohammad DAMT. Fixes bug #50922.

svn path=/trunk/mcs/; revision=19977

mcs/class/System.Web/System.Web.SessionState/ChangeLog
mcs/class/System.Web/System.Web.SessionState/SessionInProcHandler.cs

index 3c925fa4fabe615a8c2a57d8bb66f58b65953f80..d7e833d16cf5541cfbac33211bb8949eb83bd66e 100644 (file)
@@ -1,3 +1,9 @@
+2003-11-13  Jackson Harper <jackson@ximian.com>
+
+       * SessionInProcHandler.cs: Use AppDomain.SetData so data is
+       available across all threads. Set the path of session id
+       cookies. Patch by Mohammad DAMT. Fixes bug #50922.
+        
 2003-11-06 Jackson Harper <jackson@ximian.com>
 
        * ISessionHandler.cs: Pass the SessionStateModule to handlers when
index fc0ed94fff29a67fcaa1b677893e4f9a81b39fa3..d9d819c2ad94e04ac7e9887aff2e6db5303b472a 100644 (file)
@@ -16,6 +16,7 @@
            * Generate SessionID:s in a good (more random) way.
 */
 using System;
+using System.IO;
 using System.Collections;
 
 namespace System.Web.SessionState
@@ -67,7 +68,9 @@ namespace System.Web.SessionState
 
                public void Init (HttpApplication context, SessionConfig config)
                {
-                       _sessionTable = new Hashtable();
+                       _sessionTable = (Hashtable) AppDomain.CurrentDomain.GetData (".MonoSessionInProc");
+                       if (_sessionTable == null)
+                               _sessionTable = new Hashtable();
                }
 
                public void UpdateHandler (HttpContext context, SessionStateModule module)
@@ -111,6 +114,7 @@ namespace System.Web.SessionState
                                                                                false)); //readonly
                        // puts it in the table.
                        _sessionTable [sessionID]=container;
+                       AppDomain.CurrentDomain.SetData (".MonoSessionInProc", _sessionTable);
 
                        // and returns it.
                        context.SetSession (container.SessionState);
@@ -118,7 +122,9 @@ namespace System.Web.SessionState
 
 
                        // sets the session cookie. We're assuming that session scope is the default mode.
-                       context.Response.AppendCookie (new HttpCookie (COOKIE_NAME,sessionID));
+                       HttpCookie cookie = new HttpCookie (COOKIE_NAME,sessionID);
+                       cookie.Path = Path.GetDirectoryName (context.Request.Path);
+                       context.Response.AppendCookie (cookie);
 
                        // And we're done!
                        return true;