EventFiringEnabled is not the answer as it prevents firing new events as the result of updates done by my code.
The cause of the error is that
ItemDeleting event is synchronous. It means that its receivers are executed in the same thread as original operation and moreover all other sync event receivers. And only one redirect is
OK. The 2nd one causes error you mention (because it tries to do 2nd redirect in single thread).
I deployed following sample you can use:
/// List Item Events
public class EventReceiver1 : SPItemEventReceiver
private static SortedDictionary<DateTime, Guid> transactions;
/// An item is being deleted.
public override void ItemDeleting(SPItemEventProperties properties)
if (transactions == null) transactions = new SortedDictionary<DateTime, Guid>();
Guid currentCorrelationId = CorrelationId.GetCurrentCorrelationToken();
properties.Status = SPEventReceiverStatus.CancelWithRedirectUrl;
properties.RedirectUrl = "Default.aspx";
private void CleanIds(double delay)
foreach (DateTime dt in transactions.Where(t => t.Key < DateTime.Now.AddSeconds(-1.0*delay)).Select(t => t.Key))
public class CorrelationId
public static extern uint EventActivityIdControl(uint controlCode, ref Guid activityId);
public const uint EVENT_ACTIVITY_CTRL_GET_ID = 1;
public static Guid GetCurrentCorrelationToken()
Guid g = Guid.Empty;
EventActivityIdControl(EVENT_ACTIVITY_CTRL_GET_ID, ref g);