KeepAlive for the DotImage WebThumbnailViewer

Published 09 January 09 08:20 AM | jacobl 

This is my third post on the topic of using a simple JavaScript call to keep a server session alive. My first post was on keeping a generic IIS session alive by reloading a hidden GIF, my second was related directly to keeping session state alive for the WebImageViewer, and this post will address the WebThumbnailViewer.

Using the WebThumbnailViewer with the WebImageViewer

If you're interested in keeping a session alive for a page that contains both a WebImageViewer and a WebThumbnailViewer working in tandem, you only need to keep the session for the WebImageViewer alive since they share the same stamp file in the AtalaCache. However, if you are using just the WebThumbnailViewer, this blog is for you.

Server Side

Luckily, you need not make any change to your code-behind. There is something very simple that we can call in DotImage on the client-side that will do the job for us.

Client Side

This is super simple. WebThumbnailViewer has an UpdateThumb call that does a round trip to the server, requests a thumb, and serves it. This causes the state keepalive that we are looking for.

   1: var keepAliveIframe = null;
   2: function KeepAlive(){
   3:     WebThumbnailViewer1.UpdateThumb(0);
   4: }
   5: setInterval('KeepAlive();', '900000');

That's it. Just add that function to your page and you'll be all set. Don't forget to update the setInterval duration to something that makes sense for your deployments. 900,000 milliseconds is 15 minutes so that should work in most cases.

Comments

No Comments
Anonymous comments are disabled