Slide.Show 2 | "The remote server returned an error: NotFound

Orly and I downloaded Slide.Show 2, opened the project with Visual Studio 2010, and all the samples worked great.

One of the options for selecting the photos to be displayed is to provide an XML file listing each photo together with a description. This works very well, but has the disadvantage that the XML file has to be prepared in advance, and it is not that simple to choose between files. Orly had previously written a Handler that creates an XML document containing all of the photos in a directory tree, and used that to replace the static XML file for the original Slide.Show, and we spliced this Handler into the samples and everything worked as expected. Enough with the sample application, now it is time to make a clean version that we can deploy.

I set up a new project and copied the pertinent files to it, fired up the debugger web browser, and nothing. No error message, nothing except a formatted browser window with no slide show.

A bit more detail is needed here, there is a second XML file involved. This second file is named configuration.xml, and it contains the parameters to customize the look and feel of  Slide.Show 2 . In our case it is a very simple file with the following information:

<?xml version="1.0" encoding="utf-8" ?>
<configuration background="Black" 
	AutoStart="false" StartInAlbumView="true">
  <module name="EmbedViewer">
    <option name="Enabled" value="false" />
  </module>
  <module name="ToggleEmbedViewButton">
    <option name="Enabled" value="false" />
  </module>
  <module name="ToggleSaveButton">
    <option name="Enabled" value="true" />
    <option name="DownloadImageHandler" 
		value= "http://localhost/Samples/DownloadImage.ashx?image=" />
  </module>
  <module name="SlideDescription">
    <option name="DescriptionHeight" value="60" />
  </module>
  <module name="SlidePreview">
     <option name="Height" value="150" />
  </module>

</configuration>

In due course we traced the failure to load to the line in the code where it was trying to load this configuration.xml file. The Inner exception was: “The remote server returned an error: NotFound”. We spent hours trying to find why this file would not load. Permissions were fine, the file is an exact copy of the one that worked in the sample, and it was in the same directory as the html file that was hosting the slide show control, which was also an exact copy of the sample – except for the path names that is. Here is the pertinent part of the code that invokes the slide show control.

	<!-- Code in the working sample Default.html -->
	<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider; 
		Path=../XMLConfiguration/Configuration.xml, ... />
	<!-- Code in the failing AutoShow Default.html -->
	<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider; 
		Path=Configuration.xml, ... />

The reason for the more complex path in the sample is that there were several examples in the sample and each was called from a single page that acted as a menu. Each example is in a directory, in our example the directory was named XMLConfiguration. We tried the path ./configuration.xml and .\configuration .xml and read way to many items from Google.

Eventually Orly decided to try black magic of moving the configuration file up a level from the html file that calls it. Bingo. AutoShow started to work exactly as the sample worked. The code is here:

	<!-- Code in the working AutoShow Default.html -->
	<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider; 
		Path=../up/Configuration.xml, ... />
	<!-- Code in the final working AutoShow Default.html -->
	<param name="initParams" value="ConfigurationProvider=XmlConfigurationProvider;
		Path=.././Configuration.xml, ... />	

Both of these calls work as they should. The .././ version does not require the extra directory, so that is the one we went with, but neither makes sense to me. Anyone who has any idea why these changes made the application start to work, please let me know in the comments.

You can see an example of it working here.

5. January 2011 13:44 by Kal | Comments (0) | Permalink
Comments are closed

Calendar

<<  February 2012  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
2728291234
567891011

View posts in large calendar