laptop and a wrench

Bug

Session state in SQL Server causes the switch of visibility of map resource item to fail.

Last Published: August 25, 2014 No Product Found
Bug ID Number NIM008710
SubmittedMay 8, 2007
Last ModifiedJune 5, 2024
Applies toNo Product Found
Version found9.2
StatusWill Not Be Addressed

Additional Information

No Public Explanation

Workaround

Objects stored in session state must be serializable if the mode is SQL Server. It's not very clear if ESRI web controls save unserializeable objects into session variables.Two workarounds were sent to the user.1. Remove all resource items and only add that single map resource item that should be visible.2. Turn off all layers inside those map resource items that should be invisible. Only layers in one resource item is set visible.Here is the code snippet for workaround 2: private void SetLayersVisibility(int resource_index, bool visibleSetting) { ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality mf = (ESRI.ArcGIS.ADF.Web.DataSources.IMapFunctionality)Map1.GetFunctionality(resource_index); ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality ags_mf = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapFunctionality)mf; //ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase ags_mr = (ESRI.ArcGIS.ADF.Web.DataSources.ArcGISServer.MapResourceBase)qfunc.Resource; ESRI.ArcGIS.ADF.ArcGISServer.MapDescription mapdescription; mapdescription = ags_mf.MapDescription; ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription[] layerdescs = mapdescription.LayerDescriptions; for (int layer_index = 0; layer_index < layerdescs.Length; layer_index++) { ESRI.ArcGIS.ADF.ArcGISServer.LayerDescription featureLayer = layerdescs[layer_index]; featureLayer.Visible = visibleSetting; } } private string SwitchMapService(string serviceName) { for (int resource_index = 0; resource_index < MapResourceManager1.ResourceItems.Count; resource_index++) { if (MapResourceManager1.ResourceItems[resource_index].Name != serviceName) { SetLayersVisibility(resource_index, false); } else { SetLayersVisibility(resource_index, true); } } Map1.Refresh(); Toc1.Refresh(); Map1.CallbackResults.AddRange(Toc1.CallbackResults); string mapcallbackresults = Map1.CallbackResults.ToString(); return mapcallbackresults; }

Steps to Reproduce

Bug ID: NIM008710

Software:

  • No Product Found

Get notified when the status of a bug changes

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options