Hi,
I've got a browser-enabled InfoPath 2013 form hosted in SharePoint 2013, with some code behind that interacts with the ASP.Net session state. I've enabled the SharePoint session state service (SQL Server mode) and configured the web.config to enable session state.
At the moment the form just has a button with one line of code which executes onClick:
HttpContext.Current.Session.Add("Foo", "1");
This should create a session state variable called "Foo" with a value of 1 when the button is clicked.
However the code fails with an "Object reference not set to an instance of an object" error. I put some checks into the code to see what was going on, and it transpires that HttpContext.Current.Session is coming back null.
Does anyone have any ideas why this might be?
Thanks
Anthony