This project is read-only.

URIs with query strings

Jan 29, 2010 at 12:28 AM

Hi,

I am trying display a GIF that is returned from a query string. Problem is the GIF does not display and I am not sure what I can do to have it show up properly. Here is my code.

XAML

<imgTool:AnimatedImage x:Name="slideStarField" Source="none.gif" Height="441" Width="441" Margin="380,90,166,19" />

Code behind

ImageTools.IO.Decoders.AddDecoder<GifDecoder>();

ImageTools.Image skyImg = new ImageTools.Image();
skyImg.UriSource = new Uri("http://stdatu.stsci.edu/cgi-bin/dss_search?v=phase2_gsc2&r=19%3A57%3A18&d=-53%3A09%3A36&e=J2000&h=15.0&w=15.0&f=gif&c=none&s=on&fov=NONE&v3=fasdf");
//skyImg.UriSource = new Uri("http://grb.sonoma.edu:81/welcome.gif");

slideStarField.Source = skyImg;

The line that is commented out works but the one with the query string does not. I would appreciate any help anyone can provide.

Thanks, Kamal

Jan 29, 2010 at 8:38 AM

The AnimatedImage class has an Event named ExceptionOccured, please subscribe to this event to get more details about the problem.

I use the WebClient class to download the image, which has  many restrictions:

http://msdn.microsoft.com/en-us/library/cc189008%28VS.95%29.aspx, Please take a look

Jan 29, 2010 at 8:38 PM

Hi,

Thanks for your quick reply. I am new to Silverlight (C# too for that matter) so I am not quite sure how to implent what you suggested "The AnimatedImage class has an Event named ExceptionOccured, please subscribe to this event to get more details about the problem."

If I put the URL with querystring directly in the XAML like so

<imgTool:AnimatedImage x:Name="slideStarField" Source="http://stdatu.stsci.edu/cgi-bin/dss_search?v=phase2_gsc2&r=19%3A57%3A18&d=-53%3A09%3A36&e=J2000&h=15.0&w=15.0&f=gif&c=none&s=on&fov=NONE&v3=fasdf" Height="441" Width="441" Margin="380,90,166,19" />

I get the following error.

Entity references or sequences beginning with an ampersand '&' must be terminated with a semicolon ';'.

So, I changed it to Source="http://stdatu.stsci.edu/cgi-bin/dss_search?v=phase2_gsc2&amp;r=19%3A57%3A18&amp;d=-53%3A09%3A36&amp;e=J2000&amp;h=15.0&amp;w=15.0&amp;f=gif&amp;c=none&amp;s=on&amp;fov=NONE&amp;v3=fasdf"

Changing & to &amp;

The error went away but the image will still not show. Please advice. Kamal

Feb 8, 2010 at 12:42 PM

Sorry, I have some time this week to test it, when necessary. Would be nice, if you give me a feedback, if you want me to make a test.

Feb 8, 2010 at 9:22 PM

Hi,

Thanks for taking the time. I appreciate any response you can provide. I think maybe the problem has to do with the fact that a query string is the source of the image since if I use a straight url like http://grb.sonoma.edu:81/welcome.gif it works fine.

It might be an unforseen bug. I have since found another way to solve my problem. I use a php script to convert the gif to jpg and use that in my silverlight app but I would be more that happy to test any changes you make to ImageTools. Of course, you don't have to if you don't want to. :)

 

Kamal

Feb 8, 2010 at 10:27 PM

Can you please add an policy file to the root of your domain? http://timheuer.com/blog/archive/2008/04/06/silverlight-cross-domain-policy-file-snippet-intellisense.aspx

Feb 9, 2010 at 7:44 PM

Hi,

Are you referring to the http://stdatu.stsci.edu domain? Unfortunately, I do not have have access to that domain. That is where I am trying to get the image from but my app is hosted at http://grb.sonoma.edu:81/sl and this does have a cross-domain policy file.

I was able to display a gif from a domain without a x-domain policy if I used a direct link, i.e. no query string.

Kamal