Guest User

Untitled

a guest
May 25th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. public override void RemoveItem(HttpContext context,
  2. string id,
  3. object lockId,
  4. SessionStateStoreData item)
  5. {
  6. var conn = new MySqlConnection(connectionString);
  7. var cmd = new MySqlCommand("DELETE FROM sessions WHERE SessionId = ?SessionId AND ApplicationName = ?ApplicationName AND LockId = ?LockId", conn);
  8. cmd.Parameters.Add("?SessionId", MySqlDbType.VarChar, 80).Value = id;
  9. cmd.Parameters.Add("?ApplicationName", MySqlDbType.VarChar, 255).Value = ApplicationName;
  10. cmd.Parameters.Add("?LockId", MySqlDbType.Int32).Value = lockId;
  11.  
  12. try
  13. {
  14. conn.Open();
  15.  
  16. cmd.ExecuteNonQuery();
  17. }
  18. catch (MySqlException e)
  19. {
  20. if (WriteExceptionsToEventLog)
  21. {
  22. WriteToEventLog(e, "RemoveItem");
  23. throw new ProviderException(exceptionMessage);
  24. }
  25. else
  26. throw e;
  27. }
  28. finally
  29. {
  30. conn.Close();
  31. }
  32. }
Add Comment
Please, Sign In to add comment