Search KB Filter article types
Configuring - General Tab - Keep Connected
Categories: State handling
Tags: Architects, Developers, XML, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
Revision: 1
Posted: 05/Oct/2009
Updated: 04/Dec/2010
Status: Publish
Types: Reference

Overview

This article is a part of articles on Configuring Visual WebGui application General tab

Settings
Keep Connected settingsDefault valueweb.configDescription
Keep Connected Interval120000<WebGui> <KeepConnectedInterval Value="120000" /> <KeepConnectedLimitation Value="0" /> </WebGui>
Time in milliseconds between KeepConnected requests when application is idle
Keep Connected limitation0Number of times a KeepConnected request should be sent, until the application times out

General

In Visual WebGui, to simulate a Windows Forms connected and stateful environment over the web, we have KeepConnected requests sent every two minutes (default), unless changed in the KeepConnectedInterval configuration. These requests are sent indefinately, unless the KeepConnectedLimitation configuration is changed. numerical values placed in the KeepConnectedLimitation configuration state how many KeepConnected requests will be sent to the server by the client before stopping completely, allowing the session to be killed by ASP.NET.

If for example the ASP.NET sessionState timeout setting is set to 2 (minutes) for example and ((KeepConnectedInterval * KeepConnectedLimitation) / 1000) would be larger than 1 (half of 2), if something went wrong, the ASP.NET could kill the session before the first KeepConnected request from the client would arrive at the server.
As a result we suggest the users always have the ((KeepConnectedInterval * KeepConnectedLimitation) / 1000) at most half of the sessionState timout configuration. This also is suggested in much larger time spans.

Keep application alive indefinitely

Using the recommended settings above, set KeepConnectedLimitation = 0, and then make sure that KeepConnectedInterval is less than half of the sessionState timeout.

Example: KeepConnectedLimitation = 0, sessionState timeout = 20 min, KeepConnectedLimitation = 540000 (9 minutes). In this scenario the default KeepConnectedLimitation = 120000 is also fine.

Timeout session before application

This can be useful in authenticating applications with Logon forms, where you want to timeout the application and show the logon form when it times out.

For this purpose, you need to make sure that you get no KeepConnected requests within the sessionState timeout counter period, as the KeepConnected request will reset the sessionState timeout counter. This means that you need to set KeepConnectedInterval to a little greater value than your sessionState timeout.

Example: sessionState Timeout = 5 min, KeepConnectedLimitation = 0 (indefinite) and KeepConnectedInterval = 310000 (5 minutes and 10 seconds).

Timeout application and use redirect on timeout

This can be useful if you do want your application to time out, and on timeout you want the user redirected to a specific page.

For this purpose, you would be overriding the Timeout Html document via a Theme, and change it to redirect when loaded (that is, on timeout). See the Themes page on how to override this document.

For this purpose you need to activate the KeepConnectedLimitation setting to a non-zero value, which will decide how many KeepConnectedInterval periods will pass before the application is timed out. You also need to make sure that the sessionState timeout is set to a value that is greater than KeepConnectedInterval times (KeepConnectedLimitation + 1), as if you don't, the session will be destroyed before the timeout has been reached, and you will never get a timeout.

Example: KeepConnectedInterval = 60000 (1 minute), KeepConnectedLimitation = 5. This will give you 6 minutes, 7 to be sure, so it should be safe to set sessionState timeout = 10 min, or even keep it at the default 20.

ReferencesForum ThreadsIssuesOther references

About the author

Related Articles

State handling  
Title Update Author
Tags: Developers, Navigation, 2. Intermediate, 3. Advanced, ASP.NET, Pre v6.3, v6.3, v6.4 and Later
05/Jan/2009    2009/01/05
This article explains how to configure a Visual WebGui application to work without using cookies.
Tags: Developers, XML, 1. Beginner, 2. Intermediate, 3. Advanced, ASP.NET, Pre v6.3, v6.3, v6.4 and Later
02/May/2011    2011/05/02
Tags: Architects, Developers, XML, 1. Beginner, 2. Intermediate, 3. Advanced, Pre v6.3, v6.3, v6.4 and Later
24/May/2010    2010/05/24
.NET HTML5 Web, Cloud and Mobile application delivery | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2012 Visual WebGui®       Visual WebGui weblog on ASP.NET Gizmox Blog Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS