This is a simple example using <a href="http://ASP.NET">ASP.NET</a> and OpenLayers using the usual Sheboygan example. Sorry but I don&#39;t know yet how to load legend. For the selection I have not tried yet, but OpenLayers accepts the xml returned by selection in params, so using selection  as in MapGuide Dev&#39;&#39;s guide should work [see comment in code] - I didn&#39;t tested.<br>

For tooltips you can query the server on mouse move, standard AJAX stuff, but I would do it only in intranets or with big server power, otherwise you would be bombing the server with requests.<br>To have more layers, you can add an overlay [<i>in options 
useOverlay=true, useAsyncOverlay=true, the second only for 
MapGuide&gt;=2.1</i>] using the same session, just changing show/hide 
layers string.<br>
And yes, to come up with the following code was really hard! <br>NOTE: call in <b>Global.asax</b> <span style="font-family: courier new,monospace;">MapGuideApi.MgInitializeWebTier(Webconfig Ini Physical Path);</span><br>

<br><i>Devs guide says this shoul be called on every request, I call it once in <b>Global.asax</b>, and it works. I don&#39;t know more and haven&#39;t found any info!</i><br><br>
<br><br><span style="font-family: courier new,monospace;">&lt;%@ Page Language=&quot;C#&quot; %&gt;<br>&lt;%@ Import Namespace=&quot;OSGeo.MapGuide&quot; %&gt;<br><br>&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd</a>&quot;&gt;<br>

<br>&lt;script runat=&quot;server&quot;&gt;<br>    private string _strSessionId = &quot;&quot;;<br>    private string _mapName = &quot;&quot;;<br>    string _csvShowLayers = &quot;&quot;;<br>    string _csvHideLayers = &quot;&quot;;<br>

<br>    protected string GetMapName()<br>    {<br>        return _mapName;<br>    }<br>    protected string GetMapSession()<br>    {<br>        return _strSessionId;<br>    }<br>    protected string GetShowlayers()<br>    {<br>

        return _csvShowLayers;<br>    }<br>    protected string GetHidelayers()<br>    {<br>        return _csvHideLayers;<br>    }<br><br>    private void MgDispose(MgDisposable obj)<br>    {<br>        if (obj != null) obj.Dispose();<br>

    }<br><br>    protected void Page_Load(object sender, EventArgs e)<br>    {<br>        MgUserInformation userInfo = null;<br>        MgSiteConnection siteConnection = null;<br>        MgSite site = null;<br>        MgResourceIdentifier resourceId = null;<br>

        MgMappingService mappingService = null;<br><br>        MgMap map = null;<br>        MgResourceService resourceService = null;<br>        MgSelection selection = null;<br><br>        MgLayerCollection lColl = null;<br>

        MgLayerBase layerBase = null;<br>        MgResourceIdentifier sessionIdResourceIdentifier = null;<br><br>        try<br>        {<br>            userInfo = new MgUserInformation(&quot;Anonymous&quot;, &quot;&quot;);<br>

            siteConnection = new MgSiteConnection();<br>            siteConnection.Open(userInfo);<br><br>            site = siteConnection.GetSite();<br>            _strSessionId = site.CreateSession();<br><br>            //---------------------------------------------------<br>

            //Save new mapguide session<br>            userInfo.SetMgSessionId(_strSessionId);<br>            //---------------------------------------------------<br><br>            resourceId = new MgResourceIdentifier(&quot;Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&quot;);<br>

            _mapName = resourceId.GetName();<br><br>            //------------------------------------------------<br>            //Layers objectId<br>            mappingService = (MgMappingService)siteConnection.CreateService(MgServiceType.MappingService);<br>

            map = new MgMap();<br>            resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;<br>            map.Create(resourceService, resourceId, _mapName);<br><br>            lColl = map.GetLayers();<br>

            int iMax = lColl.Count;<br><br><br>            //Let&#39;s show only Districts &amp; Hydrography:<br>            StringBuilder sbShow = new StringBuilder();<br>            StringBuilder sbHide = new StringBuilder();<br>

            int iHid = 0, iShow = 0;<br>            for (int i = 0; i &lt; iMax; ++i)<br>            {<br>                if (null != layerBase) layerBase.Dispose();<br>                layerBase = lColl[i];<br>                string layername = layerBase.GetName();<br>

                if (layername == &quot;Districts&quot;)<br>                {<br>                    if (iShow &gt; 0) sbShow.Append(&quot;,&quot;);<br>                    sbShow.Append(layerBase.GetObjectId());<br>                    ++iShow;<br>

                }<br>                else if (layername == &quot;Hydrography&quot;)<br>                {<br>                    if (iShow &gt; 0) sbShow.Append(&quot;,&quot;);<br>                    sbShow.Append(layerBase.GetObjectId());<br>

                    ++iShow;<br>                }<br>                else<br>                {<br>                    if (iHid &gt; 0) sbHide.Append(&quot;,&quot;);<br>                    sbHide.Append(layerBase.GetObjectId());<br>

                    ++iHid;<br>                }<br>            }<br>            _csvHideLayers = sbHide.ToString();<br>            _csvShowLayers = sbShow.ToString();<br>            //------------------------------------------------<br>

<br>            //------------------------------------------------<br>            //Necessary to show maps:<br>            selection = new MgSelection(map);<br>            selection.Save(resourceService, _mapName);<br><br>

            sessionIdResourceIdentifier = new MgResourceIdentifier(<br>                String.Concat(&quot;Session:&quot;, _strSessionId, &quot;//&quot;, _mapName, &quot;.&quot;, MgResourceType.Map));<br>            map.Save(resourceService, sessionIdResourceIdentifier);<br>

            //------------------------------------------------<br>        }<br>        catch<br>        {<br>            throw;//TODO: Handle exceptions<br>        }<br>        finally<br>        {<br>            MgDispose(sessionIdResourceIdentifier);<br>

            MgDispose(selection);<br><br>            MgDispose(layerBase);<br>            MgDispose(lColl);<br><br>            MgDispose(resourceService);<br>            MgDispose(map);<br><br>            MgDispose(resourceId);<br>

            MgDispose(mappingService);<br>            MgDispose(site);<br>            MgDispose(siteConnection);<br>            MgDispose(userInfo);<br>        }<br>    }<br>&lt;/script&gt;<br><br>&lt;html xmlns=&quot;<a href="http://www.w3.org/1999/xhtml">http://www.w3.org/1999/xhtml</a>&quot;&gt;<br>

&lt;head runat=&quot;server&quot;&gt;<br>    &lt;title&gt;&lt;/title&gt;<br>    &lt;script type=&quot;text/javascript&quot; src=&quot;<a href="http://www.openlayers.org/api/OpenLayers.js">http://www.openlayers.org/api/OpenLayers.js</a>&quot;&gt;&lt;/script&gt;<br>

    &lt;style type=&quot;text/css&quot;&gt;<br>    #map_mg<br>    {<br>        width: 500px;<br>        height:500px;<br>        float: left;<br>        border:solid 1px #000;<br>    }<br>    &lt;/style&gt;<br>    <br>&lt;/head&gt;<br>

&lt;body onload=&quot;init()&quot;&gt;<br>        &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;<br>    &lt;div&gt;<br>        &lt;h2&gt;Qick example: TODO: Dispose all map guide objects, use StringBuilder, etc...&lt;/h2&gt;<br>

        &lt;h3&gt;Showing only Districts/Hydrography&lt;/h3&gt;<br>    &lt;/div&gt;<br>        &lt;div id=&quot;map_mg&quot;&gt;<br>        &lt;/div&gt;<br>    &lt;/form&gt;<br>    <br>    &lt;script type=&quot;text/javascript&quot;&gt;<br>

        var addrs = &quot;<a href="http://localhost/">http://localhost/</a>&quot;; //TODO: get the address of your server<br>        var mg_url = addrs + &quot;mapguide/mapagent/mapagent.fcgi?USERNAME=Anonymous&amp;&quot;;<br>

        var metersPerUnit = 111319.4908;  //TODO: get value returned from mapguide on server side<br>        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;<br>        OpenLayers.INCHES_PER_UNIT[&quot;dd&quot;] = inPerUnit;<br>

        OpenLayers.INCHES_PER_UNIT[&quot;degrees&quot;] = inPerUnit;<br>        OpenLayers.DOTS_PER_INCH = 96;<br>        var _map = null;<br><br>        function init() {<br>            //TODO: get extent from mapguide on server side<br>

            //      I usually get extent on server side, I don&#39;t write here code, because Double&#39;s ToString<br>            //      in my locle [Italian] gives &quot;,&quot; insted of &quot;.&quot;, and I have an assembly  to make conversion.<br>

            //      You can find howto do it easily on Programmer&#39;s guide or on WebApi help<br>            var extent = new OpenLayers.Bounds(-87.865114442365922, 43.665065564837931, -87.595394059497067, 43.823852564430069);<br>

            var mapOptions = {<br>                maxExtent: extent,<br>                maxResolution: &#39;auto&#39;<br>            };<br>            _map = new OpenLayers.Map(&#39;map_mg&#39;, mapOptions);<br><br>            var options = {<br>

                isBaseLayer: true,<br>                buffer: 1,<br>                useOverlay: false,<br>                useAsyncOverlay: false,<br>                singleTile: true<br>                //, transitionEffect: &#39;resize&#39;<br>

            };<br>            var params = {};<br>            params.mapName = &#39;&lt;%= GetMapName() %&gt;&#39;;<br>            params.session = &#39;&lt;%= GetMapSession() %&gt;&#39;;<br>            params.hideLayers = &#39;&lt;%= GetHidelayers() %&gt;&#39;;<br>

            params.showLayers = &#39;&lt;%= GetShowlayers() %&gt;&#39;;<br>            // - Depending on Groups you can use params.showGroups/hideGroups<br>            // - Making a selection os server side, you can get that selection and pass here as param.selectionXml<br>

            // - I have read somewhere that locale should be passed [and that in some cases is mandatory] too, but it works for me even without<br><br>            var mg_layer = new OpenLayers.Layer.MapGuide(&quot;MapGuide Sheboygan map&quot;, mg_url, params, options);<br>

            _map.addLayer(mg_layer);<br><br>            _map.addControl(new OpenLayers.Control.MousePosition());<br>            _map.zoomToMaxExtent();            <br>        }<br>    &lt;/script&gt;<br>&lt;/body&gt;<br>
&lt;/html&gt;<br>
</span><br><br><br>Pietro Ianniello<br>
<br>