03-26-2007, 11:31 AM
Is there a way to have a web application that uses AJAX for data manipulation, but at the same time, will activate session activity for the web application?
I am having issues with my web application timing out after X-minutes but when really I'm actively using the application.
Thanks to all for their help.
03-28-2007, 09:19 AM
what is your session time out set at? if you're using the application via Ajax or Postbacks the session should be maintained automatically. i was using the Ajax.Net framework a while back, and it seemed to maintain the state without me having to do anything.
are you staying on one page the whole time and doing everything via AJAX? Or are you posting back at any time? Can you give us any more information about exactly what you're doing?
03-30-2007, 10:15 AM
Yes, I agree with Wayne here, we need more info. AJAX really has nothing to do with the Session in general. The default session expiration would be 20 minutes, dictated by the last request to the server.
If your session has indeed expired, you can leverage the scriptmanager_init() event and check if the session has expired. If so, you can redirect to a login page, error page or whatever means you see fit.
03-30-2007, 12:21 PM
wayneph and MKoslof,
Thank you both for your reply. I am sorry it has taken me awhile to respond...
I have an application that manipulates several databases and I'm using AJAX to communicate with an ASP.NET page and relays the data to be displayed on a Session Active page. Once the user has finished generating their specific report, they would then click on a next button to activate a Page Postback to which their selected data is further manipulated....
The session time out is 20 minutes, and if a user were to play with this AJAX stage for over 20 minutes, that page's session would timeout. I was just wonderring if there was a way for all AJAX transactions to relay a message to the page's session to activate a keep-alive.
I have a feeling MKoslof is correct in saying AJAX doesn't have an effect with sessions. And if that is indeed correct, what would be a better method to what I'm doing?
The minus to Page Postbacks is that the page will be refreshed, and I have flash objects that take at least a minute to load in the browser and those objects maintain the user's position with the application. I wouldn't want that to be lost by a refresh.
Sorry I wrote a novel. But hopefully everyone has a better idea of what I'm describing.
Thanks to all with their help.
03-31-2007, 07:09 PM
Well, what I was saying is that as a rule, the session will expire after 20 minutes if no request is sent to the server. Whether you use AJAX or any technology this is the case :).
You can extended the session timeout, but the issue I see here is that I get the impression you have no concrete way of knowing when the next request is going to be sent to the server. The user can "play" with the AJAX stage for 3 minutes or 30 minutes, you don't know.
If you want to get fancy, you can use Asyc httpHandlers and occassionally send back a request to server to dictate "hey we are still alive" but in general, you probably want to set up a system where the user isn't dependant on AJAX functionality for an UNCONTROLLED period of time without sending a request back to server.