[mapguide-users] Sessions on server side

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Mon Feb 22 11:03:05 EST 2010

Instead of keeping sessions, and lists of sessions, how about this:

Create a "start solution.aspx" that the anonymous users get a link to.
In this file, simply log in as the anonymous user on MapGuide (or 
whatever user you want to pose as anonymous).
Redirect to the MapGuide viewer, passing SESSION=xxx to the solution, 
using the session id you just created.

You can then keep track of how many sessions there are active, using the 
.Net session events:

I recommend that you maintain a short session timeout, and "ping" an 
aspx page to keep the session alive.

The number of active users depend on hardware, the dataset, the user 
behavior, etc.
You can only determine this through testing.
On an infinitely fast machine, MapGuide can serve an infinite number of 

If you want something really fancy, MapGuide has some performance 
counters you can poll.

Yes, you should call dispose, and yes, it is annoying that you cannot 
use using().
You can create a trac ticket, stating what you want changed,
to give a better .Net experience when acessing MapGuide:

Due to this problem (and other similar) problems, I have built the 

You cannot reference a class directly without referencing the dll (eg 
You can use a more generic try/catch to read the description without 
knowing the type:
     //Bad code here
catch (Execption ex)
     //Also catches MgExceptions and the like

Btw., your attachment did not make it.

Regards, Kenneth Skovhede, GEOGRAF A/S

On 22-02-2010 16:41, Pietro Ianniello wrote:
> Dear list,
> This question is for those who have knowledge of MagGuide internals.
> I want to be able to give access to some maps to anonymous users, in a 
> way transparent to their session [I mean that session seems not to 
> expire to such users].
> My idea is to maintain a list of session ID on server side, let’s say 
> 10. Then on every request I pick one of my sessions, check if it’s 
> expired, if it is recreate the session, and then use it to serve the map.
> NOTE: this only for anonymous users, obviously!
> I would like to know:
> - What do you think of such a solution?
> - How can I calculate a good number of server side maintained sessions?
> The second question can be reformulated: How many concurrent request 
> is a SINGLE MapGuide server able to serve in a reasonable time…for a 
> typical map, let’s say for 
> "/Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition/", because 
> it depends from the complexity of the map.
> Then I would like to pose some problems I have encountered using 
> MapGide with ASP.NET <http://ASP.NET>, witch are related to how 
> managed classes are generated (using SWIG, I suppose).
> The first is that Exceptions are not [Serializable] decorated, and 
> don’t implement the “Iserializable” interface. So if someone uses 
> MapGuide classes inside an assembly (as I do), she cannot catch 
> OSGeo.MapGuide.ManagedException, OSGeo.MapGuide. MgException, etc….
> The second is releted to Dispose: all classes expose a Dispose 
> function but don’t expose IDisposable interface, so we cannot use 
> “using()”, but must always use try/finally, wich, when there are many 
> variables, can bring to ugly code.
> This brigs me to the following question: I always try to Dispose ALL 
> AND EVERYTHING. Is it correct? In my opinion if a class exposes a 
> Dispose member, I MUST CALL Dispose.
> A have attached an ASP.NET <http://ASP.NET> site with an example 
> implementation of the server side maintained sessions. It’s a little 
> bit spaghetti, because it’s a rewrite of a different implementation… 
> for example in the method MgSheboyganCacheHelper.GetMgMapAnonymous the 
> MgSite is not disposed… but… should it be or when disposing the 
> related Mgmap it will be automatically disposed [this relates to the 
> Dispose question above]?
> Regards,
> Pietro Ianniello
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20100222/d0e6e11b/attachment.html

More information about the mapguide-users mailing list