0

I need to keep the session of my application alive. I have seen that it can be set to a certain time by implementing the following code:

Sub Session_OnStart
    Session.Timeout = 90
End Sub

Is there any way to make in unlimited? Thanks

ekad
  • 14,436
  • 26
  • 44
  • 46
Furqan Sehgal
  • 4,917
  • 33
  • 108
  • 167
  • 1
    possible duplicate of [No required "Session Timeout",](http://stackoverflow.com/questions/17105807/no-required-session-timeout) – Habib Jan 22 '14 at 15:38
  • [MS forums.asp.net](http://forums.asp.net/t/1285066.aspx?unlimited%20session%20timeout%20) – MattC Jan 22 '14 at 15:39
  • Can I ask why you need this. – Matt Wilko Jan 22 '14 at 15:59
  • I explain you my requirement, may be you can advise me something. I need to send an email message to user every 10 minutes. Code is in Global.asax. As long as session runs, it works fine. When session is closed, it stops working. – Furqan Sehgal Jan 22 '14 at 16:17
  • Perhaps you should move your code so that it fires on Application_Start and Stop instead of Session_Start Stop? Better still just have a timer object in a separate class. The session stopping will not affect it then – Matt Wilko Jan 22 '14 at 19:41

2 Answers2

0

In my opinion is a really bad idea to make the session unlimited, the best thing you can do is to store the login information and restore the session when an user postback in your site, so you don't need the iis to set high timeout times.

theLaw
  • 1,261
  • 2
  • 11
  • 23
  • btw is not possible to set unlimited timeout, you must use a js for postback at a given time – theLaw Jan 22 '14 at 15:42
  • javascript, you can try to see there http://stackoverflow.com/questions/1431733/keeping-asp-net-session-open-alive – theLaw Jan 22 '14 at 16:20
0

If not possible why not alert user that session is about to time out

Session Timeout Warning in ASP.NET

Community
  • 1
  • 1
Key-eat
  • 3
  • 1
  • 4
  • and how to refresh a minute before it expires? – Furqan Sehgal Jan 22 '14 at 16:19
  • @Furqan Sehgal: if you follow this link it will give you all the info you need [http://www.codeproject.com/Articles/227382/Alert-Session-Time-out-in-ASP-Net] the code is JavaScript, place code in the head of ur html – Key-eat Jan 23 '14 at 11:04