<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Something like this would do it with MaestroAPI (untested):<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaestroAPI.ServerConnectionI con; //Needs initialization<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Read the current resources<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaestroAPI.WebLayout layout =
con.GetWebLayout("???.WebLayout");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaestroAPI.MapDefinition map =
con.GetMapDefinition(layout.Map.ResourceId);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Create the temp layer<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MaestroAPI.MapLayerType layer = new
OSGeo.MapGuide.MaestroAPI.MapLayerType();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layer.ResourceId = "???.LayerDefinition";<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layer.Name = "Temporary layer";<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Add it to the map<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; map.Layers.Add(layer);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Generate a session based temporary id (will become
Session:&lt;sessionid&gt;//Random Map Identifier.MapDefinition)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string tempMapId = new
MaestroAPI.ResourceIdentifier("Random Map Identifier",
MaestroAPI.ResourceTypes.MapDefinition, con.SessionID);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Save the modified map in the session repo<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.SaveResourceAs(map, tempMapId);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Modify the layout to point at the temp map<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; layout.Map.ResourceId = tempMapId;<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Generate a session based temporary id, and save the
modified layout (will become Session:&lt;sessionid&gt;//Random WebLayot
Identifier.WebLayout)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; string tempLayoutId = new
MaestroAPI.ResourceIdentifier("Random WebLayout Identifier",
MaestroAPI.ResourceTypes.WebLayout, con.SessionID);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; con.SaveResourceAs(layout, tempLayoutId);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //Open the viewer with the modified weblayout, that uses
the modified map<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Response.Redirect("/mapguide/mapviewerajax/?session=" +
Server.UrlEncode(con.SessionID) + "&amp;layout=" +
Server.UrlEncode(tempLayoutId));<br>
<br>
You can rewrite the property access with the corresponding xml changes,<br>
and the GetResource/SaveResource with the corresponding function calls
to the<br>
MapGuide API, if you don't want to use Maestro.<br>
<br>
Instead of the "Random ... Identifier" strings, you should use
Guid.NewGuid().ToString().<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
euskalmap skrev:
<blockquote cite="mid:1246870217220-3212013.post@n2.nabble.com"
 type="cite">
  <pre wrap="">Hi,
thanks for your information but how do you make toYou have to create a
temporary WebLayout AND a temporary MapDefinition and then make the
temporary WebLayout point to the temporary MapDefinition.
Have you an example of code?
Thnaks

Kenneth Skovhede, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">If you save to "Library://" the data will be modified permanently.
Normally the "Anonymous" user is not allowed to save to "Library://".

If you save to "Session:&lt;sessionid&gt;//" the changes will only be visible to
the current user. You must take care not to mix sessionid's.

I think you are trying to use the WebLayout from Library, that will not 
work.
You have to create a temporary WebLayout AND a temporary MapDefinition.

Then make the temporary WebLayout point to the temporary MapDefinition.
(I think your code does this)
Then save both WebLayout and MapDefinition in "Session:&lt;sessionid&gt;//".
When you redirect, you should point to the temporary WebLayout.
As you pass in the sessionId, the viewer should be able to read it 
correctly.

Regards, Kenneth Skovhede, GEOGRAF A/S




euskalmap skrev:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi,
I refresh my post! If you have an idea !!!

Sorry, I wanted to say that my c# code change the mapdefinitin in the
layout
for the current session;
if i use administrator user, it seems to me that my repositories is
modified
in maestro, no and i will not ?
For (Sample 1) my code is  <a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/ag_default3.aspx">http://patxi.mayol.free.fr/ag_default3.aspx</a>
here 
For (Sample 2) my xml file is  <a class="moz-txt-link-freetext" href="http://patxi.mayol.free.fr/test_after.xml">http://patxi.mayol.free.fr/test_after.xml</a>
here 
Thanks 

Kenneth Skovhede, GEOGRAF A/S wrote:
  
      </pre>
      <blockquote type="cite">
        <pre wrap="">You mention "layout resource", but the message states a MapDefinition is 
saved?
Anonymous can only save to the same session, only Administrator can save 
across
sessions.

As for the parse error, your document is likely invalid.

For (Sample 1), can you post the related code?
For (Sample 2), can you post a binary copy of the document you are 
trying to save?

Regards, Kenneth Skovhede, GEOGRAF A/S



euskalmap skrev:
    
        </pre>
        <blockquote type="cite">
          <pre wrap="">Hi,
I modify, by c# script, the name of the layout resource; i use the
MgUserInformation function with Anonymous user without password. 
sample1 : In mapguide administrator this user have no role =&gt; so when i
load
the page i have this message : 
Permission denied to resource:
Session:98d50e40-ffff-ffff-8000-0016d44491c1_en_7F0000010AFC0AFB0AFA//Map_40312.MapDefinition 
sample 2 : if i add the role Adminstrator and Map Author of the
Anonymous
user, i have this message :
An exception occurred in DB XML component. Error: XML Indexer: Fatal
Parse
error in document at line, 1, char 1. Parser message: Invalid document
structure 

I understand anything ! Have you an idea ?

Thanks
  
      
          </pre>
        </blockquote>
        <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    
        </pre>
      </blockquote>
      <pre wrap="">  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!---->
  </pre>
</blockquote>
</body>
</html>