c# - ASP.NET Page dies after 30 minutes - Stack Overflow

admin2025-04-21  4

On all of the ASP.NET Web Forms project I publish I always have the same error. When the page is left idle for 30 minutes, if I try to do something like push a button, (if customErrors is off) the page throws an error to the console:

MicrosoftAjaxWebForms.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'PRM_ServerError')
at Sys.WebForms.PageRequestManager._createPageRequestManagerServerError (MicrosoftAjaxWebForms.js:6:11462)
at Sys.WebForms.PageRequestManager._parseDelta (MicrosoftAjaxWebForms.js:6:29608)
at Sys.WebForms.PageRequestManager._onFormSubmitCompleted (MicrosoftAjaxWebForms.js:6:25637)
at Array.<anonymous> (MicrosoftAjax.js:6:307)
at MicrosoftAjax.js:6:51370
at Sys.Net.WebRequestpleted (MicrosoftAjax.js:6:89678)
at XMLHttpRequest._onReadyStateChange (MicrosoftAjax.js:6:84277)

If CusomeErrors is on, it just redirects to the page error. Also this doesn't happen while running from Visual Studio. I have tried this <sessionState timeout="180" /> And setting Cookie settings: Mode=AutoDetect, Name=ASP.NET_SessionId, TimeOut=180 minutes, Regenerate expired session id=checked in IIS Manager -> Site -> Session State

I'm not providing any code because this happens with every ASP.NET Web Forms project that I work on. It's simply independent of my code.

On all of the ASP.NET Web Forms project I publish I always have the same error. When the page is left idle for 30 minutes, if I try to do something like push a button, (if customErrors is off) the page throws an error to the console:

MicrosoftAjaxWebForms.js:6 Uncaught TypeError: Cannot read properties of undefined (reading 'PRM_ServerError')
at Sys.WebForms.PageRequestManager._createPageRequestManagerServerError (MicrosoftAjaxWebForms.js:6:11462)
at Sys.WebForms.PageRequestManager._parseDelta (MicrosoftAjaxWebForms.js:6:29608)
at Sys.WebForms.PageRequestManager._onFormSubmitCompleted (MicrosoftAjaxWebForms.js:6:25637)
at Array.<anonymous> (MicrosoftAjax.js:6:307)
at MicrosoftAjax.js:6:51370
at Sys.Net.WebRequest.completed (MicrosoftAjax.js:6:89678)
at XMLHttpRequest._onReadyStateChange (MicrosoftAjax.js:6:84277)

If CusomeErrors is on, it just redirects to the page error. Also this doesn't happen while running from Visual Studio. I have tried this <sessionState timeout="180" /> And setting Cookie settings: Mode=AutoDetect, Name=ASP.NET_SessionId, TimeOut=180 minutes, Regenerate expired session id=checked in IIS Manager -> Site -> Session State

I'm not providing any code because this happens with every ASP.NET Web Forms project that I work on. It's simply independent of my code.

Share Improve this question edited Jan 23 at 11:46 Martin Mercado asked Jan 22 at 22:52 Martin MercadoMartin Mercado 11 bronze badge 2
  • 1 I would check the app pool settings on the server - it's likely re-starting. However, if you can (have access to the web server), then I would simply turn on state server. That will result in your sessions() etc. persisting, and it even persists if you re-start IIS or the app-pool. I find session() VERY flakey, and adopting SQL server based sessions(), or even less effort, the session state service, then code and web site behaviors become rock solid.... – Albert D. Kallal Commented Jan 22 at 22:58
  • No code, only exception stack? It could be anything. Please see: How to create a Minimal, Reproducible Example. – Sergey A Kryukov Commented Jan 23 at 0:26
Add a comment  | 

1 Answer 1

Reset to default -1

The issue you're encountering seems related to the session timing out due to idle inactivity, which causes the session to expire. This results in the "Cannot read properties of undefined" error in your JavaScript when the user attempts to interact with the page after the session has expired. Since this works fine during development in Visual Studio but not when deployed, the problem likely stems from how the session timeout and cookies are managed in IIS or the ASP.NET application configuration.

Or Implement session expiration handling in JavaScript and/or server-side logic to gracefully handle expired sessions.

Or If necessary, investigate load balancing issues or use a centralized session store.

转载请注明原文地址:http://www.anycun.com/QandA/1745224955a90448.html