ASP / Ajax Session Solution
“ ”
Navigation
I have been working through a number of issues around the migration of a traditional web application to an Ajax implementation. We have a rather extensive ecommerce application that uses a two site model; the front end is the public ecommerce site, with a separate support/back office backend site. We decided last year to start the process of migrating support features in AJAX functions. The objective was to migrate the Support features into the public ecommerce site using a gradual coding process.
This gradual process has allowed us to solve the AJAX coding and structural challenges in phases without having to focus all our development time to the process. Below is an issue and a solution we found during the last phase.
It appears that Ajax (prototype) will not setup ASP session variables in the browser from a Ajax call. We use Prototype and we find that customers will login into the support site, then attempt some action after their session has timed out. We have a process that will check for a unique cookie key per user. Normally this process will re-establish the user's session to preserve the work flow.
But we have found that while ASP will recognize the session variables during the processing of the script using the users cookie. It will not place in the users browser the required session cookies that would normally allow normal session state.
After a little research, we found that this is not uncommon issue for Ajax developers. And it makes sense, that Ajax.Updater would not behave actually as the browser HTML header does when it is directed to place a session cookie.
So we found a work around. We wrote a ASP function that will check and rebuild the session for specific page. When the user refreshes or changes the parent page the normal session rebuilding process will kick in. But in the actual AJAX function, the session will rebuild as needed, until the session reestablished by the browser.
Sometimes fighting the application server and the browser are not worth the effort. So while the rebuild function does not appeal to our inner coder, it does get the job done!
- SSmith's blog
- Login to post comments



