Created
May 18, 2010 13:49
-
-
Save mrichman/405018 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void RemoveItem(HttpContext context, | |
string id, | |
object lockId, | |
SessionStateStoreData item) | |
{ | |
var conn = new MySqlConnection(connectionString); | |
var cmd = new MySqlCommand("DELETE FROM sessions WHERE SessionId = ?SessionId AND ApplicationName = ?ApplicationName AND LockId = ?LockId", conn); | |
cmd.Parameters.Add("?SessionId", MySqlDbType.VarChar, 80).Value = id; | |
cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = ApplicationName; | |
cmd.Parameters.Add("?LockId", MySqlDbType.Int32).Value = lockId; | |
try | |
{ | |
conn.Open(); | |
cmd.ExecuteNonQuery(); | |
} | |
catch (MySqlException e) | |
{ | |
if (WriteExceptionsToEventLog) | |
{ | |
WriteToEventLog(e, "RemoveItem"); | |
throw new ProviderException(exceptionMessage); | |
} | |
else | |
throw e; | |
} | |
finally | |
{ | |
conn.Close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment