Endless session

  • Thread starter Thread starter Mircea Pleteriu
  • Start date Start date
M

Mircea Pleteriu

Hi all,

Does anybody know how to configure the session so that the session will
never expire?
 
The sessionState tag in the web.config files allows to control the session
timeout but typically it should be set to the lowest value that fits your
needs, not to an excessive or infinite value...

I believe you have some other kind of problem you should workaround another
way. For example, permanent values should be IMO best stored in a "user
profile" stored in the database rather than to be kept "permanently" in an
infinite session (you can however "cache" these values as session variables
if needed)...

Patrice
 
hi,
why on earth u want ENDLESS session.
hv mercy on ur SERVER..
neverthless keep timeout value say 24 * 60 min
 
Bad idea:You server will be full of unused sessions. And eventually will run
out of memory.


Here is the solution.

1. Create and ASPX renewSession.aspx that outputs transaprent gif 1x1 pixel.
2. In every page have a folowing HTML
<IMG name="renewSession" height=1 src="/Root/images/transparentpixal.gif"
width=1 border=0>

3. Add to every page folowing Javascript.

<script language="Javascript">
window.setInterval("renewSession()", 600000);

function renewSession()
{
document.images("renewSession").src = /Root/renewSession.aspx?par=" +
Math.random();
}
</script>

So basically an idea that browser will request renewSession.aspx every 10
minutes thus preventing session expiration.

George.
 
Sounds like a good recipe for a .Net "memory leak." That would be the
outcome.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top