As joel and Ciprian Tarta mentioned, the code for the MySQL session state store provider contained a little bug in the RemoveItem method. I fixed this bug and also tried to re-format the document.
You can download the document here.
Enjoy!
Hi Harry!I`m not getting this file…why? How i can get it? Are there others links?
I have no idea. Downloads just fine on my side. Did you also try to download v.03?
None of my sessions are expiring – there are 10,000 records in my sessions table. I’ve fixed the DELETE FROM sessions query as well. Please see here for my code: http://gist.github.com/405018 I have made minor changes for ASP.NET 3.5. Any suggestions?
As stated in the comments section of the source code, this is the desired behavior.This session state store provider does not automatically clean up expired session item data. It is recommended that you periodically delete expired session information from the data store with the following code (where ‘conn’ is the MySqlConnection for the session state store provider):string commandString = "DELETE FROM sessions WHERE Expires < ?Expires";MySqlConnection conn = new MySqlConnection(connectionString);MySqlCommand cmd = new MySqlCommand(commandString, conn);cmd.Parameters.Add("?Expires", MySqlDbType.DateTime).Value = DateTime.Now;conn.Open();cmd.ExecuteNonQuery();conn.Close();Alternatively, one can set a Scheduled Task for execute the following:mysql -u<UserName> -p<Password> -h<DB Host Name> DB_Name -e"DELETE FROM sessions WHERE Expires < NOW();"