[mapguide-users] Mapguide beta 2.4: quick plot on a basic layout
from .net app does not work
Francesco Sozzi
fsozzi at intercad.ch
Thu Apr 12 04:59:09 EDT 2012
Hi list,
I've just downloaded Mapguide 2.4 beta and tried to compile a very simple
.Net c# application.
My target is to use the great new feature "QuickPlot" on my basic layout
(this layout type is a must for me, I have an application based on this).
But I have problems on using QuickPLot from a .Net app.
You can see attached the code for the very simple single class Default.aspx.
I've created an IIS "Application folder"
http:\\localhost\mapguide\MapGuideSample and I execute my app from there.
My problem is that:
- if I preview from Maestro my web layout
(Library://TBDemoMesoccoCan/BasicLayout.it.WebLayout) I can use QuickPlot.
- but if I execute this simple app on the same web layout QuickPlot is not
responsive; I can open the dialog, but it does nothing. I can't see the
rectangle on the map and if I press "Generate" button, nothing happens. No
errors are displayed.
Thanks in advance for any help...
-------------- next part --------------
--------------------------------------------------------------------------------------------------------------------------
Default.aspx
--------------------------------------------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="MapGuideSample.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Viewer Sample Application</title> </head>
<frameset id="idFrameset" rows="0,*" frameborder="no" framespacing="0" runat="server">
<frame id="idFBanner" frameborder="no" marginwidth="0" marginheight="0" scrolling="no" runat="server"/>
<frame id="idFMap" frameborder="no" marginwidth="0" marginheight="0" scrolling="no" runat="server"/>
</frameset>
</html>
--------------------------------------------------------------------------------------------------------------------------
Default.aspx.cs
--------------------------------------------------------------------------------------------------------------------------
using System;
using OSGeo.MapGuide;
namespace MapGuideSample
{
public partial class Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String webLayout = "Library://TBDemoMesoccoCan/BasicLayout.it.WebLayout";
String defaultUser = "Administrator";
String defaultPassword = "admin";
String sessionId = "";
try
{
// Initialize a session and register a variable to hold the
// session id, then initialize the Web Extensions, connect
// to the site, and create a session.
OSGeo.MapGuide.MapGuideApi.MgInitializeWebTier(@"C:\trash\MapGuideSample\MapGuideSample\webconfig.ini");
MgUserInformation userInfo = new MgUserInformation(defaultUser, defaultPassword);
MgSite site = new MgSite();
site.Open(userInfo);
sessionId = site.CreateSession();
idFMap.Attributes["src"] = @"http://lptop-franz7vmwin7/Mapguide/mapviewernet/ajaxviewer.aspx?SESSION=" + sessionId + "&WEBLAYOUT=" + webLayout;
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
}
}
--------------------------------------------------------------------------------------------------------------------------
More information about the mapguide-users
mailing list