Ok im attempting to simply load a weblayout from the library and write it to the session then redirect the browser to the session weblayout .... is this possible
I will attempt to adjust the center scale and position as well but for now i can't even load it from the session any help is much appreciated protected void Page_Load(object sender, EventArgs e) { Response.Charset = "utf-8"; MapGuideApi.MgInitializeWebTier(Request.ServerVariables["APPL_PHYSICAL_PATH"] + "../webconfig.ini"); string webLayout = @"Library://portbris/layouts/portbrisStandard.WebLayout"; string defaultUser = "Administrator"; string defaultPassword = "admin"; MgUserInformation userInfo = new MgUserInformation(defaultUser, defaultPassword); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo); MgSite site = siteConnection.GetSite(); string sessionId = site.CreateSession(); MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService; if (Request["X"] != null && Request["Y"] != null && Request["scale"] != null) { string centerX = Request["X"].ToString(); string centerY = Request["Y"].ToString(); string scale = Request["scale"].ToString(); MgResourceIdentifier wlResourceId = new MgResourceIdentifier(webLayout); MgByteReader reader =resourceService.GetResourceContent(wlResourceId); XmlDocument doc = new XmlDocument(); String xmlLayoutDef = reader.ToString(); doc.LoadXml(xmlLayoutDef); //this is where i will modify the initial Center and scale //webLayoutXML.GetElementsByTagName("CenterX").Item(0).InnerText = centerX; //webLayoutXML.GetElementsByTagName("CenterY").Item(0).InnerText = centerY; //webLayoutXML.GetElementsByTagName("Scale").Item(0).InnerText = scale; MgResourceIdentifier newLayout = new MgResourceIdentifier("Session:" + sessionId + "//portbrisStandard.WebLayout"); resourceService.SetResource(newLayout, new MgByteReader(doc.OuterXml, "text/xml"), null); Response.Redirect("http://vmapp04/mapguide2010/mapviewerajax/?WEBLAYOUT=Session:" + sessionId + "//portbrisStandard.WebLayout"); //http://vmapp04/mapguide2010/portbris/SendToFriend/default.aspx?x=500&y=500&scale=500 } } -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/Load-weblayout-from-library-and-write-to-session-then-load-tp5930738p5930738.html Sent from the MapGuide Users mailing list archive at Nabble.com. _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users