I'm having a problem when I try to use my map project on a shared server. When I run it locally on my machine the following code works fine.
private const string ShapeRelativeUriFormat = "DataSources/Geospatial/USA/{0}";
public MainPage()
{
InitializeComponent();
this.radMap.Provider = new OpenStreetMapProvider(MapMode.Aerial, true);
this.radMap.InitializeCompleted += new EventHandler(radMap_InitializeCompleted);
}
private void radMap_InitializeCompleted(object sender, EventArgs e)
{
if (!this.initialized)
{
this.initialized = true;
this.SetupReaders();
}
}
public void SetupReaders()
{
this.informationLayer.Reader = new MapShapeReader();
this.informationLayer.Reader.PreviewReadCompleted += new PreviewReadShapesCompletedEventHandler(Reader_PreviewReadCompleted);
this.informationLayer.Reader.Source = new Uri(string.Format(ShapeRelativeUriFormat, "usa_states"), UriKind.Relative);
}
private void Reader_PreviewReadCompleted(object sender, PreviewReadShapesCompletedEventArgs eventArgs)
{
if (((MapShapeReader)sender).Source.ToString().Contains("usa_states"))
{
if (eventArgs.Items != null)
{
....some logic here
}
}
}
For some reason though, when I run the same exact code on the server it comes back with null within eventArgs.Items. Its as though it is not finding the files? I did see that eventArgs is also returning this error:
The remote server returned an error: NotFound.
Stack Trace:
at System.Net.Browser.AsyncHelper.BeginOnUI(SendOrPostCallback beginMethod, Object state)
at System.Net.Browser.BrowserHttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
at System.Net.WebClient.GetWebResponse(WebRequest request, IAsyncResult result)
at System.Net.WebClient.OpenReadAsyncCallback(IAsyncResult result)
Any ideas on how I could resolve this issue?