[mapguide-users] MAPNAME & Map.Open

Mark Pendergraft markp at Meadgilman.com
Thu Jun 28 00:05:51 EDT 2007


Okay regarding number 1, I was hoping you would provide a code snippet
or a little more info.  I'm pretty new to ASP and I'm having a really
hard time making javascript and vb.net in ASP jive, as well as just
having a hard time with javascript in general.

Regarding number 2....Thank you so much!  I knew it was something
stupid, it never occurred to me that the username/password would crash
the map.open procedure.

Thanks again for the help thus far.

-Mark P.


-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jackie Ng
Sent: Wednesday, June 27, 2007 8:55 PM
To: mapguide-users at lists.osgeo.org
Subject: Re: [mapguide-users] MAPNAME & Map.Open


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.

_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users


More information about the mapguide-users mailing list