[mapguide-users] MAPNAME & Map.Open

Jackie Ng jackie.ng at aecsystems.com.au
Wed Jun 27 23:55:05 EDT 2007


Hi Mark,

1) I use the javascript method and store the map name in a hidden form field
so it can be picked up in the Page's Request.Form collection

2) I see a few problems with this code,

- You have two sessionid variables with lower and upper "s" casings.
- You are new'ing a MgUserInformation object with username/login instead of
the sessionid. This is probably the cause of the failure, becuase MAPNAME is
tied to your session id. If you want to use Map.Open with MAPNAME you have
to open the MgSiteConnection with a MgUserInformation object that has a
session id, not user/pass.

Hope that helps.

- Jackie


Mark Pendergraft wrote:
> 
> I'm hoping that someone can help me with a few questions:
> 
>  
> 
> 1)  How are people passing the MAPNAME variable to their application
> pages?   I understand that you can use the javascript function
> parent.parent.mapframe.getmapname, however, I am unsure how to retain
> the value from this.  How do I transfer this variable to my asp.net
> page.
> 
>  
> 
> 2)  I am unable to open a Map at all.  Every app I have made so far
> creates a map.  My code thus far:
> 
>  
> 
> <!-- #Include File="../UtilityFunctions.aspx" -->
> 
>  
> 
> <script runat="server">
> 
>     Private webLayout As String =
> "Library://Kroll/Layout/MGAJobMapLayout.WebLayout"
> 
>     Private MapDef As String = "Library://Kroll/Map/MGA.MapDefinition"
> 
>     Private defaultUser As String = "Anonymous"
> 
>     Private defaultPassword As String = ""
> 
>     Private sessionId As String = ""   
> 
> </script>
> 
>  
> 
> <%
> 
>     Try
> 
>            
> 
>         InitializeWebTier()
> 
>  
> 
>         Dim SessionId As String = GetRequestParameters("SESSION")
> 
>         
> 
>         Dim UserInfo As New MgUserInformation(defaultUser,
> defaultPassword)
> 
>         Dim site As New MgSite()
> 
>         site.Open(UserInfo)
> 
>        
> 
>         'for testing purposes only
> 
>         If SessionId = "" Then site.CreateSession()
> 
>         'for testing purposes only
> 
>         
> 
>         Dim ResourceService As OSGeo.MapGuide.MgResourceService
> 
>         Dim siteconnection As New MgSiteConnection
> 
>         siteconnection.Open(UserInfo)
> 
>         ResourceService =
> siteconnection.CreateService(MgServiceType.ResourceService)
> 
>        
> 
>         Dim MapDefId As New MgResourceIdentifier(MapDef)
> 
>         Dim MapName As String = MapDefId.Name
> 
>         Dim Map As New MgMap(siteconnection)
> 
>         Map.Open(ResourceService, MapName)
> 
>                 
> 
>         Dim srs As String = Map.GetMapSRS
> 
>         
> 
>         Response.Write("Map <strong>" + Map.GetName + "</strong> uses
> this reference system: </br>" + srs + "</br></br></br>")
> 
>                 
> 
>         Dim MapLayers As MgLayerCollection
> 
>         MapLayers = Map.GetLayers
> 
>         Dim Layer As MgLayer
> 
>         Response.Write("<strong>Map Layers</strong></br>")
> 
>         For Each Layer In MapLayers
> 
>             Response.Write(Layer.Name + "</br>")
> 
>         Next
> 
>                                       
> 
>     Catch ex As Exception
> 
>         Response.Write(ex.Message)
> 
>         Response.Write(ex.StackTrace)
> 
>     End Try
> 
>     
> 
> %>
> 
>  
> 
>  
> 
> This code errors out at Map.Open everytime
> 
> 
> _______________________________________________
> mapguide-users mailing list
> mapguide-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
> 
> 

-- 
View this message in context: http://www.nabble.com/MAPNAME---Map.Open-tf3992128s16610.html#a11336576
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list