I’m trying to obtain the HTTPContext within an Event Handler in a Document Library in MOSS, but all I have is a null value of the HTTPContext.Current, I do the same thing on a L
An item event receiver run asynchronously; you will not have access to the HTTP request that initiated the event.
Step 1 Declare:
private HttpContext currentContext;
static HttpContext _stCurrentContext;
Step 2
currentContext = HttpContext.Current; // in constructor
Step3
public override void ItemAdding(SPItemEventProperties properties)
_stCurrentContext = currentContext;
Step 4
public override void ItemAdded(SPItemEventProperties properties)
if (_stCurrentContext.Request.Files[0].ContentLength > 0)
HttpPostedFile uploadfile = _stCurrentContext.Request.Files[0];