views:

463

answers:

2

I want my asp.net mvc(C#) application to be with the session without expire.

The Session should be active forever the user opens the application.

Whats the best way to do it?

A: 

I know two possibilities. First, set the session timeout in web.config to very long time interval. Second, set the timeout to moderate interval like 10 or 20 minutes and include the ajax call to some method on server that does nothing. And make that call every, say 3-5 minutes, like some sort of keep-alive call. The downside is that you should have this javascript on every page so it will be better to put in on the master page

B-Rain
A long timeout will keep the sessions alive on the server using resources, long after the user has left.The ajax keep-alive is much better.
Hans Kesting
added the ajax call script in master page. that helped out my issue
Prasad
A: 

You might want to have a look at this for a possible solution.

Schmuli