[mapguide-users] Resource data was not found

François Van Der Biest francois.van-der-biest at onf.fr
Wed Oct 11 03:48:08 EDT 2006


You might find a solution to your problem here : 
http://www.nabble.com/How-to-check-if-session-is-expired--tf2218864.html#a6549987

It took me a lot of time to find this trick.

F.

Cory Gregor a écrit :
> The code is blowing up on this line:  map.Open(ResourceService,
> mgResourceID);
> The browser is telling me " Resource datawas not found:  RuntimeDataResource
> data was not found: ....."
>
> Is the some IIS config problem maybe?  IIS 6 on Win2k3 Server.
>
> Here is the code...
>
>     //String mapDefinition =
> "Library://Samples/FredWeber/Maps/Default.MapDefinition";
>     //String webLayout = "Library://Samples/FredWeber/FredWeber.WebLayout";
>     String sessionId = "";
>     String NoLayers = "No Layers Selected";
>
>     try
>     {
>         MapGuideApi.InitializeSockets();
>         InitializeWebTier();
>
>         MgUserInformation userInfo = new MgUserInformation("XXXX","YYYY");
>         MgSite site = new MgSite();
>
>         site.Open(userInfo);
>
>         sessionId = site.CreateSession();
>
>         MgSiteConnection siteConnection = new MgSiteConnection();
>         siteConnection.Open(userInfo);
>
>         MgResourceService ResourceService =
> siteConnection.CreateService(MgServiceType.ResourceService) as
> MgResourceService;
>         MgFeatureService FeatureService =
> siteConnection.CreateService(MgServiceType.FeatureService) as
> MgFeatureService;
>         MgFeatureQueryOptions QueryOptions = new MgFeatureQueryOptions();
>
>         MgResourceIdentifier mgResourceID = new
> MgResourceIdentifier(mapDefinition);
>         
>         MgMap map = new MgMap();
>         
>         map.Open(ResourceService, mgResourceID);
>         Response.Write("Got here");
>         MgSelection selection = new MgSelection(map);
>
>         selection.Open(ResourceService, "map");
>
>         MgReadOnlyLayerCollection Layers = selection.GetLayers();
>
>         if (Layers.GetCount() > 0)
>         {
>             for (int i = 0; i < Layers.GetCount(); i++)
>             {
>
>                 //Only check selected features in the Parcels layer.
>
>                 MgLayer Layer = Layers.GetItem(i);
>
>                 if (Layer != null && Layer.GetLayerDefinition() == new
> MgResourceIdentifier("Default_Map Base_727(3)"))
>                 {
>                     //Create a filter containing the IDs of the selected 
>                     //features on this layer
>
>                     string LayerClassName = Layer.GetFeatureClassName();
>                     string selectionString = selection.GenerateFilter(Layer,
> LayerClassName);
>
>                     //Get the feature resource for the selected layer
>
>                     string LayerFeatureId = Layer.GetFeatureSourceId();
>                     MgResourceIdentifier LayerFeatureResource = new
> MgResourceIdentifier(LayerFeatureId);
>
>                     //Apply the filter to the feature resource for the 
>                     // selected layer. This returns
>
>
>                     //an MgFeatureReader of all the selected features.
>
>                     QueryOptions.SetFilter(selectionString);
>
>                     MgFeatureReader FeatureReader =
> FeatureService.SelectFeatures(LayerFeatureResource, LayerClassName,
> QueryOptions);
>
>                     //Process each item in the MgFeatureReader, displaying
> the 
>                     //owner name and address
>
>                     while (FeatureReader.ReadNext())
>                     {
>
>                         string val = FeatureReader.GetString("FeatureID");
>
>                         //FeatureReader.GetString("Layer");
>
>                         Response.Write(val);
>
>                     }
>
>                 }
>
>             }
>
>         }
>
>         else
>         {
>             Response.Write(NoLayers);
>         }    
>        
>
>         MapGuideApi.TerminateSockets();
>     }
>     catch (MgException mge)
>     {
>         Response.Write(mge.GetMessage());
>         Response.Write(mge.GetDetails());
>         MapGuideApi.TerminateSockets();
>     }
>   





More information about the Mapguide_users mailing list