简体   繁体   中英

Expired session on a website using callbacks

I have an aspx.cs page that use only callback to connect to server side.

After the website starts running, if I work on this page for several minutes, the session has been expired. I have only used callback and I haven't used any postback. I think the session has expired because it's not arising from the postback, but my web site is callback based and I never use postback.

How can I resolve this expired session problem?

By CallBack I assume you mean ajax calls from your page. These are normal HTTP calls and carry your browser session cookie like a normal postback. Therefore your session should stay alive.

However, in debug mode your appdomain will recycle after 15 dynamic compiles, and if using InProc session state, your session will be lost.

You can increase the number of compiles before appdomain recycle using the <compilation numRecompilesBeforeAppRestart="1000" /> element in web.config .

I also recommend you use SQLServer mode for Session State, as SQL-stored sessions will survive appdomain recycles / server reboots / load-balanced server switching etc.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM