0

I have an ASP.NET application which loads a page and then does all of the work by WebMethods. So for a long time the user does not refresh the page. I think after a while the session hits the timeout and session variables are cleared, because there is at least one WebMethod request at every N minutes (N is less than Session.TimeOut). Is that true? Is there a way to change this behaviour without increasing the TimeOut value..

Christian Strempfer
  • 7,291
  • 6
  • 50
  • 75
paul simmons
  • 5,568
  • 13
  • 51
  • 78

1 Answers1

0

I found this information over here:

Async postbacks will not keep session alive unless you are using cookieless sessions. If you are using cookie based sessions (the default), then the timeout is in the cookie. Ajax calls can not update this cookie in the browser. As the session timeout logic requires sending a new cookie and getting back on redirect, the ajax calls fail to do this.

You could switch to sessionless for ajax calls (good performance idea) or go to cookieless sessions

Community
  • 1
  • 1
Dennis Traub
  • 50,557
  • 7
  • 93
  • 108
  • "As the session timeout logic requires sending a new cookie", then how does it access to session information in webmethods? – paul simmons Jan 12 '12 at 19:18
  • The session information is stored on the server as well, but the cookie timeout can't be updated through Ajax calls. – Dennis Traub Jan 12 '12 at 19:32
  • For example, you can store the information in the database. Here's more information: http://msdn.microsoft.com/en-us/library/ms972429.aspx – Ivo Jan 12 '12 at 20:07
  • @DennisTraub, how is session information distinguished on the server if there is no cookie in the webmethod call? i am a bit frustrated... – paul simmons Jan 12 '12 at 20:25
  • actually the cookie is sent with the webmethod (checked in chrome console), but timeout is not updated apperaently, ok.. – paul simmons Jan 12 '12 at 20:27