[mapguide-users] Dynamic Load WebLayout

Kenneth, GEOGRAF A/S ks at geograf.dk
Thu Mar 13 09:22:25 EDT 2008


Are you sure that your SessionID is valid, and not expired?
Are you sure that you get a Permission Denied error, and not an "Invalid 
Content" error?
I know that there are some problems with the BOM on UTF-8 data, other 
than that, it looks OK to me.

Regards, Kenneth, GEOGRAF A/S



JotaroKujo skrev:
> 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.
>
>   


More information about the mapguide-users mailing list