I'm using ArcGIS Server Local datasource. ArcGIS Web ADF MapResourceManager control maintains resources added once until session is abandoned. Why does it do so? Why not just use viewstate? Map control maintains it's state in session, too (and Toc).

The minor problem is that before adding a new MapResourceItem to MapResourceManager I have to check wether it's inside already (with normal controls I would just check for Page.IsPostBack). The major one - how am I exposed to clear map's and toc's state (other that read default values and set them, overwriting whatever it saved into it's state; extent for example). I tried to call RefreshServerObjects() on MapResourceLocal, call GetStateFromDataSourceObjects() on IMapFunctionality retrieved from Map control. The only way that works is HttpContext.Current.Session.Abandon() which is not a solution.

So how do you either turn off storing map state in session or how do you reset that state at any time?

Just found a way to clear just map's session state without abandoning whole session: map.StateManager.RemoveAllSessionState(false);

But the question is still up - why is it done this way?


The best answer is viewstate has to keep moving back and forth with page posts, versus sessionstate lives on the server. This was the ESRI workflow for there AJAX framework.

  • I would say this is pretty bad reasoning. Developer can choose to keep viewstate on serverside, too. ASP.NET controls could keep their state in session but they don't - if developer wants to keep it in session, then he would do it himself. Well, at least if this was the case they should have given the ability to switch to viewstate. – Loki Kriasus May 28 '11 at 4:08
  • Yes, but the controls have constraints on them that the user didn't have a lot of options with. We ended up going to SessionServer and letting the system handle it all; it was cleaner. Im not saying ViewState is totally bad; but when you are doing a lot of back and forth, relying on the page just keeps a lot going back and forth in my view. – D.E.Wright May 28 '11 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.