Visual Basic (Declaration) | |
---|---|
Public Property DisableClientCaching As Boolean |
C# | |
---|---|
public bool DisableClientCaching {get; set;} |
The default value is False. If True, adds a timestamp parameter ("_ts") to the REST request to prevent loading a map image from the browser's cache.
Caching is a the mechanism that an internet browser uses to speed up the display of previously visited web pages. It temporarily stores web documents on the client computer to reduce internet bandwith usage and decrease the display wait time of a web page. For ArcGIS Server generated map images, if the content changes frequently the most recent data may not display in the map when a web browser cache is used. To over come this issue, the DisableClientCaching Property can be set to True and thereby force each map request to come directly from ArcGIS Server rather than the internet browsers cache.
To see the effect of setting DisableClientCaching equal to True -vs- False, use an internet traffic monitoring application (like Fiddler) to view the Request Headers of the running client application. When DisableClientCaching = True, you will see that "_ts[A_DATE_TIME_STAMP]" value will be embedded towards the end of the web request. See the following screen shot of Fiddler for some sample web traffic captured:
How to use:
Click on one of the Radio Buttons and then interact with the map (i.e. Pan, Zoom In/Out). When DisableClientCaching = True the web request will always come from ArcGIS Server. When DisableClientCaching = False (the default setting) the web request may or may not come from ArcGIS Server depending on if you have previously visited that particular geographic location on the map within a certain time before the internet browsers cache has cleared. Use an internet web traffic monitoring application to see the effect on web request.
The XAML code in this example is used in conjunction with the code-behind (C# or VB.NET) to demonstrate the functionality.
The following screen shot corresponds to the code example in this page.
XAML | Copy Code |
---|---|
<Grid x:Name="LayoutRoot"> <!-- Add a Map Control. --> <esri:Map Background="White" HorizontalAlignment="Left" Margin="0,153,0,0" Name="Map1" VerticalAlignment="Top" Height="281" Width="574" WrapAround="True"> <!-- Add an ArcGISDynamicMapServiceLayer. --> <esri:ArcGISDynamicMapServiceLayer ID="ESRI_StreetMap_World_2D" Url="http://services.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer" /> </esri:Map> <!-- Add two Radio Buttons, one for DisableClientCaching = True and another for DisableClientCaching = False. --> <RadioButton Content="DisableClientCaching = True" Height="16" HorizontalAlignment="Left" Margin="60,131,0,0" Name="RadioButton_DisableClientCaching_True" VerticalAlignment="Top" Click="RadioButton_Click"/> <RadioButton Content="DisableClientCaching = False" Height="16" HorizontalAlignment="Left" Margin="321,131,0,0" Name="RadioButton_DisableClientCaching_False" VerticalAlignment="Top" IsChecked="True" Click="RadioButton_Click"/> <!-- Provide the instructions on how to use the sample code. --> <TextBlock Height="107" HorizontalAlignment="Left" Name="TextBlock1" VerticalAlignment="Top" Width="788" TextWrapping="Wrap" Text="Click on one of the Radio Buttons and then interact with the map (i.e. Pan, Zoom In/Out). When DisableClientCaching = True the web request will always come from ArcGIS Server. When DisableClientCaching = False (the default setting) the web request may or may not come from ArcGIS Server depending on if you have previously visited that particular geographic location on the map within a certain time before the internet browsers cache has cleared. Use an internet web traffic monitoring application to see the effect on web request."/> </Grid> |
C# | Copy Code |
---|---|
private void RadioButton_Click(object sender, System.Windows.RoutedEventArgs e) { // Get the ArcGISDynamicMapServiceLayer. ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer myArcGISDynamicMapServiceLayer = (ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer)(Map1.Layers[0]); // Set the Boolean value from the user choice of the radio buttons. bool theBoolean = false; if ((bool)RadioButton_DisableClientCaching_False.IsChecked) { theBoolean = false; } else if ((bool)RadioButton_DisableClientCaching_True.IsChecked) { theBoolean = true; } // Set the DisableClientCaching value. The default value for the service is false. myArcGISDynamicMapServiceLayer.DisableClientCaching = theBoolean; } |
VB.NET | Copy Code |
---|---|
Private Sub RadioButton_Click(sender As System.Object, e As System.Windows.RoutedEventArgs) ' Get the ArcGISDynamicMapServiceLayer. Dim myArcGISDynamicMapServiceLayer As ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer = CType(Map1.Layers.Item(0), ESRI.ArcGIS.Client.ArcGISDynamicMapServiceLayer) ' Set the Boolean value from the user choice of the radio buttons. Dim theBoolean As Boolean If RadioButton_DisableClientCaching_False.IsChecked Then theBoolean = False ElseIf RadioButton_DisableClientCaching_True.IsChecked Then theBoolean = True End If ' Set the DisableClientCaching value. The default value for the service is false. myArcGISDynamicMapServiceLayer.DisableClientCaching = theBoolean End Sub |
Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family, Windows 7, Windows 8