Friday, November 20, 2009

HttpContext in SPItemEventReceiver constructor doesn't work in ItemDeleting events

A common way of getting the context in an event handler is by setting in the constructor. This is well documented.

However, this doesn't work in Deleting events, only Updating and Adding.
public class CustomEventReceiver : SPItemEventReceiver
{
HttpContext current = null;
public CustomEventReceiver() : base()
{
current = HttpContext.Current;
}
}

No comments: