This project is read-only.

URIs with query strings

Jan 29, 2010 at 12:28 AM


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.


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

Code behind


ImageTools.Image skyImg = new ImageTools.Image();
skyImg.UriSource = new Uri("");
//skyImg.UriSource = new Uri("");

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:, Please take a look

Jan 29, 2010 at 8:38 PM


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="" 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=";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


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 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. :)



Feb 8, 2010 at 10:27 PM

Can you please add an policy file to the root of your domain?

Feb 9, 2010 at 7:44 PM


Are you referring to the 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 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.