I am running an ASP 4.5 application. On the main page the user writes his name and some other information and then goes to another page, where he should answer few questions and then click the button to finish the test. I send user info from one page to another using Session. When it takes longer than 20 mins for the user to answer the questions I get an exeption
Object reference not set to an instance of an object
[NullReferenceException: Object reference not set to an instance of an object] WebApplication1.Test.Button1_Click(Object sender, EventArgs e) +101 System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +154 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3803
I suppose that the only problem is the timeout, because everything works fine if the user does the test quickly. I've tried to add
<sessionState timeout="300" stateNetworkTimeout="300" mode="InProc" cookieless="false"/>
and
<httpRuntime targetFramework="4.5" executionTimeout="300" />
to web.config, but it didn't help. Could somebody please explain me what's wrong? Thanks