Indicates whether session state is enabled for the Map.


Namespace: AspMap.Web
Assembly: AspMapNET (in AspMapNET.dll)

Syntax

Visual Basic (Declaration)
Public Property EnableSession As Boolean
C#
public bool EnableSession { get; set; }
C++
public property bool EnableSession sealed  {
    bool get();
    void set(bool value);
}
J#
/** property */
public bool get_EnableSession();

/** property */
public void set_EnableSession(bool value);
JScript
public function get EnableSession() : bool

public function set EnableSession(value : bool);

Remarks

When the EnableSession property is True, map layers/collections of the Map will not be disposed and will be persisted between postbacks. This allows you to add layers/collections only once to improve performance of your application.

  • The EnableSession property must be set to True in the Properties window or in a Page_PreInit event handler.
  • Always check the IsSessionRestored property to prevent adding the same layers or collection items again.

Example

 Copy Code
void Page_Load(object sender, System.EventArgs e)
{
    if (!map.IsSessionRestored)
    {
        map.AddLayer(MapPath("/maps/states.shp"));
    }
}

See Also