I tried to use Session state inside an event receiver's itemupdated event but it threw this error: Object not set to an instance of an object.
I have attached this event receiver to a form library. Perhaps this info will help.
this is all what I used:
public override void ItemUpdated(SPItemEventProperties properties)
{
HttpContext.Current.Session["OldValue"] = "Some value";
}
Edit: One more thing. I have enabled session state in sharepoint. these are the steps that I have followed:
1) Enable-SPSessionStateService –DefaultProvision
2) <pages enableSessionState="true" in web.config
3) <add name="Session" type="System.Web.SessionState.SessionStateModule" /> inside modules element in web.config
Have I forgotten something?
Any idea why it is throwing this error?