Endless session

M

Mircea Pleteriu

Hi all,

Does anybody know how to configure the session so that the session will
never expire?
 
P

Patrice Scribe

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
 
N

.NET Follower

hi,
why on earth u want ENDLESS session.
hv mercy on ur SERVER..
neverthless keep timeout value say 24 * 60 min
 
G

George Ter-Saakov

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.
 
K

Kevin Spencer

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top