Session state in SQL Server causes the switch of visibility of map resource item to fail.
Last Published: August 25, 2014No Product Found
Bug ID Number
NIM008710
Submitted
May 8, 2007
Last Modified
June 5, 2024
Applies to
No Product Found
Version found
9.2
Status
Will Not Be Addressed
The development team has considered the issue or request and concluded it will not be addressed. The issue's Additional Information section may contain further explanation.
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; }