+2005-05-27 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+ * RemoteStateServer.cs:
+ * HttpSessionState.cs:
+ * SessionSQLServerHandler.cs:
+ * SessionInProcHandler.cs:
+ * SessionStateServerHandler.cs: remove abandoned sessions in the
+ ReleseRequest state. Fixes bug #75051.
+
2005-04-20 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* SessionSQLServerHandler.cs:
private bool _isCookieless;
private SessionStateMode _mode;
private bool _isReadonly;
- private bool _abandoned;
+ internal bool _abandoned;
internal HttpSessionState (string id,
SessionDictionary dict,
item.Touch ();
return item;
}
+
+ internal void Remove (string id)
+ {
+ table.Remove (id);
+ }
}
}
this.config = config;
}
- public void UpdateHandler (HttpContext context, SessionStateModule module) { }
+ public void UpdateHandler (HttpContext context, SessionStateModule module)
+ {
+ HttpSessionState session = context.Session;
+ if (session == null || session.IsReadOnly || !session._abandoned)
+ return;
+
+ HttpRuntime.Cache.Remove ("@@@InProc@" + session.SessionID);
+ }
public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
bool required, bool read_only, ref bool isNew)
public void UpdateHandler (HttpContext context, SessionStateModule module)
{
- if (context.Session == null || context.Session.IsReadOnly)
+ HttpSessionState session = context.Session;
+ if (session == null || session.IsReadOnly)
return;
- string id = context.Session.SessionID;
- SessionDictionary dict = context.Session.SessionDictionary;
-
- UpdateSession (id, dict);
+ string id = session.SessionID;
+ if (!session._abandoned) {
+ SessionDictionary dict = session.SessionDictionary;
+ UpdateSession (id, dict);
+ } else {
+ DeleteSession (id);
+ }
}
public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,
command.ExecuteNonQuery ();
}
+ private void DeleteSession (string id)
+ {
+ IDbCommand command = cnc.CreateCommand ();
+ IDataParameterCollection param;
+
+ string update = "DELETE FROM ASPStateTempSessions WHERE SessionId = :SessionID";
+ command.CommandText = update;
+ param = command.Parameters;
+ param.Add (CreateParam (command, DbType.String, ":SessionID", id));
+ command.ExecuteNonQuery ();
+ }
+
private IDataParameter CreateParam (IDbCommand command, DbType type,
string name, object value)
{
public void UpdateHandler (HttpContext context, SessionStateModule module)
{
- if (context.Session == null || context.Session.IsReadOnly)
+ HttpSessionState session = context.Session;
+ if (session == null || session.IsReadOnly)
return;
- string id = context.Session.SessionID;
- SessionDictionary dict = context.Session.SessionDictionary;
- HttpStaticObjectsCollection sobjs = context.Session.StaticObjects;
- state_server.Update (id, dict.ToByteArray (), sobjs.ToByteArray ());
+ string id = session.SessionID;
+ if (!session._abandoned) {
+ SessionDictionary dict = session.SessionDictionary;
+ HttpStaticObjectsCollection sobjs = session.StaticObjects;
+ state_server.Update (id, dict.ToByteArray (), sobjs.ToByteArray ());
+ } else {
+ state_server.Remove (id);
+ }
}
public HttpSessionState UpdateContext (HttpContext context, SessionStateModule module,