[mapguide-users] Sessions on server side
Pietro Ianniello
pietro.ianniello at gmail.com
Mon Feb 22 16:08:59 EST 2010
"Ok, I can see that I misjudged your experience level completely"
No problem :-), I see that there are many questions about things such as
"Can I use images in MapGuide" and such, wich are all answered in MapGuide
developer guide [wich should be printed and read ,and re-read... and
re-re-read!].
If you are intersted, you can download the attachment from
http://n2.nabble.com/Sessions-on-server-side-td4612873.html
It assumes MapGuide OS installed in "C:\OSGeo"
so "webconfig.ini" in "*C:\OSGeo\MapGuide\Web\www*",
with the .NET viewer.
If it is in another place, the file "*MgSheboyganCacheHelper.cs*" at line 61
bust be accordingly changed.
A better approach is to use the following function (as I do in my assembly
that controls MapGuide):
//call CLASSNAME.SetIniPath("/mapguide/");
public static void SetIniPath(string strMGVirtualDirectoryPath)
{
string physicalpath =
HttpContext.Current.Server.MapPath(strMGVirtualDirectoryPath);
_strWebconfigPhysicalInipath = physicalpath + "webconfig.ini";
_strIniBasePhysicalPath = physicalpath;
_strWebconfigWebInipath = strMGVirtualDirectoryPath +
"webconfig.ini";
_strIniBaseWebPath = strMGVirtualDirectoryPath;
}
wich assumes the following members [default initialized]:
protected static string _strWebconfigPhysicalInipath =
"C:\\OSGeo\\MapGuide\\Web\\www\\webconfig.ini";
protected static string _strIniBasePhysicalPath =
"C:\\OSGeo\\MapGuide\\Web\\www\\";
protected static string _strWebconfigWebInipath = "
http://localhost/mapguide/webconfig.ini";
protected static string _strIniBaseWebPath = "http://localhost/mapguide/";
My solution works, and I like it.
I only have concerns about scalability: what will MapGuide do when there are
multiple requests with the same session? Will it queue them properly as if
sessons where al different?
A further explanation on why I use such a thing.
I use MapGuide with Openlayers. OpenLayers can request
"showLayers","hideLayers". I set up maps with all layers default invisible.
The I "activate" the layers I want to see in javascript using the two
OpenLayers option just mentioned. This could be done on server side, but in
this case the state of the map would be stored in session [*
layer.SetVisible(true);map.Save();*], and, furthermore, my idea is that if
something can be done on the client, do it on the client and save
computation on the server.
The proble with "showLayers/hideLayers" is that they need "ObjectId" of the
layer. So to give that id you must do something like:
*_map.GetLayers().GetItem("<LAYER NAME>").GetObjectId();*
and this must be done on every session expiration.
So when in my solution [the real, not the posted one] I recreate the server
side mantained "cache" of session, I recreate a list with these ObjectId.
If my solution doesn't scale well, the alternative is to recreate
OpenLayers' layers with a new session and store in javascript the new
ObjectIds. This is a lot of work for many reasons it's off topic to expose.
I prefer my solution even because shelds me from exposing sessions, and with
"MgSheboyganCacheHelper.cs" I could one day [time permitting] expose
MapGuide only to localhost, using a proxy to access it - something like
"MgSheboyganCacheHelper.cs" but more general.
This for Anonymous users, and for publicly available sites.
If one wants to use MapGuide in intranet or to do editing, it's a different
story.
Regard,
Pietro Ianniello
P.S.: I could answer to my question by downloading MapGuide sources... even
though I am programming in C#, I come from C++, so it would not be a
problem, but I think it would requre HUGE ammount of time! And now I don't
have it...
P.P.S.: [out of topic] It would be nice if somwhere there is some info about
updating FDO with the current MG OS. For example usng FDO 3.4.1 instead of
3.4.0... I say this in perspective... I am very intersted in PostGIS, and
anxious to see and test a good implementation, because now it's not usable
[seems FDO 4.5 will, If I understand -
http://trac.osgeo.org/fdo/wiki/FDORfc45 - if that 45 stands for 4.5].
P.P.P.S.: I anwered 2 times before, because Mail Delivery System <
MAILER-DAEMON at lists.osgeo.org> continues to tell me that:
I'm sorry to have to inform you that your message could not
be delivered to one or more recipients. It's attached below.
Don't know why...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20100222/52ffe085/attachment.html
More information about the mapguide-users
mailing list