public override void RemoveItem(HttpContext context, string id, object lockId, SessionStateStoreData item) { Debug.Assert(context != null); Debug.Assert(lockId != null); Debug.Assert(_blobProvider != null); SecUtility.CheckParameter(ref id, true, true, false, Configuration.MaxStringPropertySizeInChars, "id"); try { sqlTableServiceContext svc = CreateDataServiceContext(); SessionRow session = GetSession(id, svc); if (session == null) { Debug.Assert(false); return; } if (session.Lock != (int)lockId) { Debug.Assert(false); return; } svc.DeleteObject(session); svc.SaveChangesWithRetries(); } catch (InvalidOperationException e) { throw new ProviderException("Error accessing the data store!", e); } // delete associated blobs try { IEnumerable <sqlListBlobItem> e = _blobProvider.ListBlobs(GetBlobNamePrefix(id)); if (e == null) { return; } IEnumerator <sqlListBlobItem> props = e.GetEnumerator(); if (props == null) { return; } while (props.MoveNext()) { if (props.Current != null) { if (!_blobProvider.DeleteBlob(props.Current.Uri.ToString())) { // ignore this; it is possible that another thread could try to delete the blob // at the same time } } } } catch (Exception e) { throw new ProviderException("Error accessing blob storage.", e); } }