<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Mangal;
        panose-1:0 0 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:"Book Antiqua";
        panose-1:2 4 6 2 5 3 5 3 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";
        color:black;}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
pre
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Book Antiqua";
        color:windowtext;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle19
        {mso-style-type:personal;
        font-family:"Book Antiqua";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
span.EmailStyle20
        {mso-style-type:personal-reply;
        font-family:"Book Antiqua";
        color:blue;
        font-weight:normal;
        font-style:normal;
        text-decoration:none none;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body bgcolor=white lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>I
have written the following code also, it uses xml and infact when this code
runs it runs perfectally without any problem, it does what I wanted to do, it
changes the map definition &nbsp;in web layout, and it runs perfectally if I run
from maestro, &nbsp;but when I try to run from my .net page<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&lt;frame
id=&quot;viewerFrame&quot; frameborder=&quot;no&quot; marginwidth=&quot;0&quot;
marginheight=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;../mapviewernet/ajaxviewer.aspx?SESSION=<span
style='background:yellow'>&lt;%</span>=sessionId<span style='background:yellow'>%&gt;</span>&amp;WEBLAYOUT=<span
style='background:yellow'>&lt;%</span>=webLayout<span style='background:yellow'>%&gt;</span>&quot;&gt;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>Then
the problem comes. And it says the following error. <o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Type
'OSGeo.MapGuide.MgNullArgumentException' in Assembly 'MapGuideDotNetApi,
Version=2.0.0.2716, Culture=neutral, PublicKeyToken=null' is not marked as
serializable.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>If I
save the map once in maestro then the viewer also runs. I have also tried to
read the header of xml and passing in resourceSrvc.SetResource as third
parameter, the problem remains the same.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>So I
just want to confirm whether maestro API you suggested would be the final and
last way to do this thing, or some other way ? Because I am not aware of using
maestro api.<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>//Here
is my code<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal style='text-indent:.5in;text-autospace:none'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo_new = new MgUserInformation(sessionId);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSiteConnection siteConnection = new MgSiteConnection();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
siteConnection.Open(userInfo_new);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceService resourceSrvc = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgMap map = new MgMap();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier resId = new<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier(&quot;Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition&quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String mapName = resId.GetName();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Create(resourceSrvc, resId, mapName);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier mapStateId = new MgResourceIdentifier(&quot;Session:&quot;
+ sessionId + &quot;//&quot; + mapName + &quot;.&quot; + MgResourceType.Map);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Save(resourceSrvc, mapStateId);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgResourceIdentifier webLayoutId = new MgResourceIdentifier(&quot;Library:// Samples/
<st1:City w:st="on"><st1:place w:st="on">Sheboygan</st1:place></st1:City> /Layouts\BasicLayout.WebLayout&quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgByteReader byteReader = resourceSrvc.GetResourceContent(webLayoutId);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlDocument doc = new XmlDocument();<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String xmlLayoutDef =
byteReader.ToString();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
doc.LoadXml(xmlLayoutDef);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlNode parentNode = doc.GetElementsByTagName(&quot;ResourceId&quot;).Item(0);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (parentNode != null)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
XmlNode mapRessource = doc.SelectSingleNode(&quot;/WebLayout/Map/ResourceId&quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
if (mapRessource != null)<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
{<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
mapRessource.InnerText = &quot;Library://Samples/Sheboygan/&quot; + &quot;Maps/Sheboygan&quot;
+ &quot;.MapDefinition&quot;;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
String string1= doc.DocumentElement.OuterXml;<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
resourceSrvc.SetResource(webLayoutId, new MgByteReader(string1, &quot;text/xml&quot;),
null);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal style='text-autospace:none'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span></font><font size=2 face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><o:p>&nbsp;</o:p></span></font></p>

<div>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Regards,<o:p></o:p></span></font></b></p>

<p class=MsoNormal><font size=2 color=gray face="Times New Roman"><span
style='font-size:11.0pt;color:gray'>Ravinder <o:p></o:p></span></font></p>

</div>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> mapguide-users-bounces@lists.osgeo.org [mailto:mapguide-users-bounces@lists.osgeo.org]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Kenneth Skovhede,
GEOGRAF A/S<br>
<b><span style='font-weight:bold'>Sent:</span></b> Saturday, February 14, 2009
4:33 PM<br>
<b><span style='font-weight:bold'>To:</span></b> MapGuide Users Mail List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapguide-users]
Regarding Linking of Layers with Map at run time</span></font><font
color=black><span style='color:windowtext'><o:p></o:p></span></font></p>

</div>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>The MgMap class represents a runtime map, not a
MapDefinition.<br>
There is no such class a a MgMapDefinition, so you have to read/write the xml.<br>
If you wish to use the standard viewer, you have to do this.<br>
I was very annoyed by this, so I created the MaestroAPI that has classes for
all the Xml documents,<br>
including the MapDefinition:<br>
<a href="http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI">http://trac.osgeo.org/mapguide/wiki/maestro/MaestroAPI</a><br>
<br>
If you start the viewer with an empty map, you can access the MgMap object,<br>
and add layers as runtime layers, using the MgMap.Layers.Add method.<br>
<br>
<br>
<o:p></o:p></span></font></p>

<pre><font size=2 color=black face="Courier New"><span style='font-size:10.0pt'>Regards, Kenneth Skovhede, GEOGRAF A/S<o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><br>
<br>
<a href="mailto:ravinder.singh@BIRLASOFT.COM">ravinder.singh@BIRLASOFT.COM</a>
skrev: <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u1:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u1:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u1:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"><!--[if gte mso 9]><xml>
    <u1:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
    <u1:shapelayout u3:ext="edit">
     <u1:idmap u3:ext="edit" data="1"/>
    </u1:shapelayout>
</xml><![endif]--></u1:SmartTagType></u1:SmartTagType></u1:SmartTagType>Hi
Stefan,<u1:p></u1:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'>I put the way
you said but it gives the following error now.<u1:p></u1:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'>Type
'OSGeo.MapGuide.MgXmlParserException' in Assembly 'MapGuideDotNetApi,
Version=2.0.0.2716, Culture=neutral, PublicKeyToken=null' is not marked as
serializable.<u1:p></u1:p></span></font><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=blue face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:blue'><u1:p>&nbsp;</u1:p></span></font><o:p></o:p></p>

<div>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Regards,<u1:p></u1:p></span></font></b><o:p></o:p></p>

<p class=MsoNormal><st1:PersonName u4:st="on"><font size=2 color=gray
face="Times New Roman"><span style='font-size:11.0pt;color:gray'>Ravinder Singh</span></font></st1:PersonName><o:p></o:p></p>

</div>

<u1:p></u1:p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
color=black face="Times New Roman"><span style='font-size:12.0pt;color:windowtext'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 color=black face=Tahoma><span
style='font-size:10.0pt;font-family:Tahoma;color:windowtext;font-weight:bold'>From:</span></font></b><font
size=2 color=black face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma;
color:windowtext'> <a href="mailto:mapguide-users-bounces@lists.osgeo.org">mapguide-users-bounces@lists.osgeo.org</a>
[<a href="mailto:mapguide-users-bounces@lists.osgeo.org">mailto:mapguide-users-bounces@lists.osgeo.org</a>]
<b><span style='font-weight:bold'>On Behalf Of </span></b>Stefan Dalakov<br>
<b><span style='font-weight:bold'>Sent:</span></b> Friday, February 13, 2009
11:10 PM<br>
<b><span style='font-weight:bold'>To:</span></b> MapGuide Users Mail List<br>
<b><span style='font-weight:bold'>Subject:</span></b> Re: [mapguide-users]
Regarding Linking of Layers with Map at run time</span></font><o:p></o:p></p>

</div>

<u1:p></u1:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u1:p>&nbsp;</u1:p><o:p></o:p></span></font></p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'>Try <br>
</span></font><font size=2 face="Courier New"><span style='font-size:10.0pt;
font-family:"Courier New"'>MgResourceIdentifier mapName = new
MgResourceIdentifier(&quot;Session:&quot; + sessionId +
&quot;//Sheboygan.MapDefinition&quot;);<br>
<br>
<br>
Stefan Dalakov<br>
<br>
</span></font><a href="mailto:ravinder.singh@BIRLASOFT.COM"
moz-do-not-send=true>ravinder.singh@BIRLASOFT.COM</a> wrote: <u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="City"><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"><u5:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="PersonName"><!--[if gte mso 9]><xml>
    <u5:shapedefaults u2:ext="edit" spidmax="1026"/>
</xml><![endif]--><!--[if gte mso 9]><xml>
    <u5:shapelayout u3:ext="edit">
     <u5:idmap u3:ext="edit" data="1"/>
    </u5:shapelayout>
</xml><![endif]--></u5:SmartTagType></u5:SmartTagType></u5:SmartTagType>Hi All,<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal style='text-indent:.5in'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I have created the map
definition in maestro and also created a web layout, and I have hundreds of
Maps, and each map will have a single layer, but I don&#8217;t want to create
the hundreds of maps for each single layer. For that purpose I though I will
just make a single map and will associate the layer at run time to that map. So
I wrote the following set of code for <st1:City u6:st="on"><st1:place u6:st="on"><st1:City u4:st="on"><st1:place u4:st="on"><st1:City
w:st="on"><st1:place w:st="on">Sheboygan</st1:place></st1:City></st1:place></st1:City></st1:place></st1:City>
sample<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>But when I reach to
map.Save(resourceSrvc, mapName) <u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>it gives me the error <u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgXmlParserException
{&quot;An exception occurred in the XML parser.&quot;}<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>And also I tried with Map.Open
and then the following error comes<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>Resource was not found:
Session:b275c3b6-ffff-ffff-8000-001a4bb4a756_en_7F0000010AFC0AFB0AFA//Samples/Sheboygan/Sheboygan.MapDefinition<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>I
have written the following code<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo = new MgUserInformation(defaultUser, defaultPassword);<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSite site = new MgSite();<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
site.Open(userInfo);<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sessionId = site.CreateSession();<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal style='margin-left:-.5in;text-indent:.5in'><font size=2
color=black face="Courier New"><span style='font-size:10.0pt;font-family:"Courier New"'>MgUserInformation
userInfo_new = new MgUserInformation(sessionId);<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgSiteConnection siteConnection = new MgSiteConnection();<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
siteConnection.Open(userInfo_new);<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgResourceService
resourceSrvc =
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>MgResourceIdentifier mapName
= new MgResourceIdentifier(&quot;Session:&quot; + sessionId +
&quot;//Samples/Sheboygan/Sheboygan.MapDefinition&quot;);<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
MgMap map = new MgMap();<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;map.Open(resourceSrvc, mapName); // Here the problem comes<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
map.Save(resourceSrvc, mapName); // Here the problem comes</span></font><u1:p></u1:p><o:p></o:p></p>

<u5:p></u5:p>

<p class=MsoNormal><font size=2 color=black face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt;font-family:"Courier New"'>I am using .net aspx with
map guide 2.0<u5:p></u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><font size=2 color=black face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua"'><u5:p>&nbsp;</u5:p></span></font><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><b><font size=2 color=gray face="Book Antiqua"><span
style='font-size:10.0pt;font-family:"Book Antiqua";color:gray;font-weight:bold'>Thanks
&amp; Regards,<u5:p></u5:p></span></font></b><u1:p></u1:p><o:p></o:p></p>

<p class=MsoNormal><st1:PersonName u6:st="on"><font size=2 color=gray
face="Times New Roman"><span style='font-size:11.0pt;color:gray'>Ravinder Singh</span></font></st1:PersonName><u1:p></u1:p><o:p></o:p></p>

<u5:p></u5:p>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u5:p>&nbsp;</u5:p><u1:p></u1:p><o:p></o:p></span></font></p>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt .75pt .75pt;
  -moz-background-clip: -moz-initial;-moz-background-origin: -moz-initial;
  -moz-background-inline-policy: -moz-initial;background-attachment:scroll;
  background-position-x:0%;background-position-y:50%'>
  <p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
  style='font-size:12.0pt'>*********************************************************************************************************************************************************************<br>
  &quot;This message and any attachments are solely for the intended recipient
  and may contain Birlasoft confidential or privileged information. If you are
  not the intended recipient,any disclosure,copying, use, or distribution of
  the information included in this message and any attachments is <br>
  prohibited. If you have received this communication in error, please notify
  us by reply e-mail at (<a href="mailto:administrator@birlasoft.com"
  moz-do-not-send=true>administrator@birlasoft.com</a>) and permanently delete
  this message and any attachments. Thank you.&quot;<br>
  *********************************************************************************************************************************************************************<u1:p></u1:p><o:p></o:p></span></font></p>
  </td>
 </tr>
</table>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><u1:p>&nbsp;</u1:p><o:p></o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre style='text-align:center'><font size=2 color=black
face="Courier New"><span style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><u1:p>&nbsp;</u1:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<u1:p></u1:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>mapguide-users mailing list<u1:p></u1:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:mapguide-users@lists.osgeo.org" moz-do-not-send=true>mapguide-users@lists.osgeo.org</a><u1:p></u1:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users"
moz-do-not-send=true>http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><u1:p></u1:p><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <u1:p></u1:p><o:p></o:p></span></font></pre>

<p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
style='font-size:12.0pt'><u1:p>&nbsp;</u1:p><o:p></o:p></span></font></p>

<table class=MsoNormalTable border=0 cellpadding=0>
 <tr>
  <td bgcolor=white style='background:white;padding:.75pt .75pt .75pt .75pt'>
  <p class=MsoNormal><font size=3 color=black face="Times New Roman"><span
  style='font-size:12.0pt'>*********************************************************************************************************************************************************************<br>
  &quot;This message and any attachments are solely for the intended recipient
  and may contain Birlasoft confidential or privileged information. If you are
  not the intended recipient,any disclosure,copying, use, or distribution of
  the information included in this message and any attachments is <br>
  prohibited. If you have received this communication in error, please notify
  us by reply e-mail at (<a href="mailto:administrator@birlasoft.com">administrator@birlasoft.com</a>)
  and permanently delete this message and any attachments. Thank you.&quot;<br>
  *********************************************************************************************************************************************************************<o:p></o:p></span></font></p>
  </td>
 </tr>
</table>

<pre wrap=""><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre
style='text-align:center'><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'>

<hr size=4 width="90%" align=center>

</span></font></pre><pre><font size=2 color=black face="Courier New"><span
style='font-size:10.0pt'><o:p>&nbsp;</o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>_______________________________________________<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>mapguide-users mailing list<o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'><a
href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a><o:p></o:p></span></font></pre><pre><font
size=2 color=black face="Courier New"><span style='font-size:10.0pt'>&nbsp; <o:p></o:p></span></font></pre></div>

</body>

</html>

<table><tr><td bgcolor=#ffffff><font color=#000000>*********************************************************************************************************************************************************************<br>
"This message and any attachments are solely for the intended recipient and may contain Birlasoft confidential or privileged information. If you are not the intended recipient,any disclosure,copying, use, or distribution of the information included in this message and any attachments is <br>
prohibited. If you have received this communication in error, please notify us by reply e-mail at (administrator@birlasoft.com) and permanently delete this message and any attachments. Thank you."<br>
*********************************************************************************************************************************************************************<br>
</font></td></tr></table>