[mapguide-users] Dynamic Load WebLayout

JotaroKujo thevise at tiscali.it
Mon Mar 10 08:00:30 EDT 2008


Hi,
I've tried to load dynamically a weblayout, but I get a Permission denied to
resource error then I try to set the resource on the resource service.

Here my code:

String layoutDef = "Session:" + mgSessionId +
@"//test."+MgResourceType.WebLayout;

        MgResourceIdentifier layoutDefId = new
MgResourceIdentifier(layoutDef);

        string strLayout = "";
        using (StreamReader rdr = File.OpenText(Server.MapPath(strXmlDir) +
"Stradario_WebLayout.xml"))
        {
          strLayout = rdr.ReadToEnd();
        }

        System.Text.UTF8Encoding encoding = new System.Text.UTF8Encoding();
        byte[] res = encoding.GetBytes(strLayout);
        
        MgByteSource src = new MgByteSource(res, res.Length);
        src.MimeType = MgMimeType.Xml;
        
        MgByteReader layoutDefContent = src.GetReader();

        resourceService.SetResource(layoutDefId, layoutDefContent, null);

Any hint?

thnx.
V.

-- 
View this message in context: http://www.nabble.com/Dynamic-Load-WebLayout-tp15950704s16610p15950704.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list