Time-out settings in the Web ADF


In this topic


About time-out settings in the Web ADF

The three time-out settings to consider when using a Web Application Developer Framework (ADF) application are as follows:
  • Web ADF (client tier)
  • ASP.NET session (Web tier)
  • Data source (server tier)
The relationships among the different time-out values and where they apply are discussed in this topic.
The Web ADF time-out is only used by the browser. The ASP.NET session time-out is not aware of the Web ADF time-out; however, they can work together. The Web ADF time-out gives you the ability to use browser logic to provide the end user with time-out details without requiring an additional request to the Web server. This is important in an asynchronous communication environment—such as Asynchronous JavaScript and XML (AJAX)-enabled Web ADF controls—where you want to intercept a callback to a Web application session that no longer exists.
In general, the Web ADF time-out is designed for the end user, while the ASP.NET session time-out is necessary from a Web application perspective to dispose of resources. With this in mind, the Web ADF time-out value can be the same as or less than the ASP.NET session time-out value. In most cases, they are the same (by default).
The data source time-out can control erroneous requests to services to ensure system resources are available and utilized appropriately. Time-out values are relative and depend on service requirements. Since most requests to services in the Web ADF are stateless, an ASP.NET session time-out is not an issue. However, if a connection to a service is persistent across requests, the relationship between an ASP.NET session time-out and a data source time-out may need to be considered.
In the case of an ArcGIS Server local connection to a non-pooled service, server context can be created once at the beginning of a session and maintained (persisted) for the duration of the session. If the maximum use time-out value on the ArcGIS Server service is less than the session time-out value, you may need to recreate server context.

Web ADF time-out

The Web ADF time-out is set during initial page load. If a page contains an ADF control, a line of JavaScript is injected into the page to set the ESRI.ADF.System.maximumLapseTime variable. By default, the value of this variable is set to the Web application session time-out value in minutes. For example, if the Web application session time-out value is 20 minutes, the following line of JavaScript is added to the page at runtime:
[JavaScript]
ESRI.ADF.System.maximumLapseTime = 20;
To change this value for a Web ADF application, you need to change the ESRI.ADF.System.maximumLapseTime variable after form contents are loaded. Add the following script tag to the Web page after the form that contains the Web ADF controls:
[JavaScript]
 < script language = "javascript" type = "text/javascript" >
     ESRI.ADF.System.maximumLapseTime = 10;
 <  / script >
To disable the Web ADF time-out, set the ESRI.ADF.System.maximumLapseTime variable to Infinity as shown in the following code:
[JavaScript]
 < script language = "javascript" type = "text/javascript" >
     ESRI.ADF.System.maximumLapseTime = Infinity;
 <  / script >
To change the message that is returned after the time-out is reached, override the ESRI.ADF.System.showLapseAlert() JavaScript function. "Override" in this sense means define the ESRI.ADF.System.showLapseAlert() JavaScript function after it is created and set at initial page load. For example, include the following code after the form tag on the aspx page:
[JavaScript]
 < script language = "javascript"type = "text/javascript" >
     ESRI.ADF.System.showLapseAlert = function(){
    alert("Application has timed out. Reloading.");
    window.location.reload();
}

 <  / script >
This triggers a page reload via JavaScript.
To check that the Web ADF time-out has elapsed, call the ESRI.ADF.System.checkSessionExpired function. If it returns true, the time-out has elapsed. Differences in browser behavior can require that you call the function or check it as a property as shown in the following code:
[JavaScript]
if (ESRI.ADF.System.checkSessionExpired && ESRI.ADF.System.checkSessionExpired()){
    //Do something or nothing. }

ASP.NET session time-out

The ASP.NET session time-out is set in the web.config file. By default, it is set to 20 minutes. To change the time-out for a Web application, add the following code to your web.config file in <system.web>:
[JavaScript]
 < sessionState timeout = "10" /  >

Data source time-out

A data source time-out is managed by the data source provider. For example, ArcIMS administrators can change the time allotted for a spatial server to process a request, and ArcGIS Server administrators can change the usage time allotted for an individual service. Administration documentation for specific data sources can provide additional details on time-out management at this level.