I’m trying to load an image from a URL in Silverlight and have followed the steps at this site but to no avail.
My code is as follows:
imageUri = new Uri("http://php.scripts.psu.edu/dept/iit/hbg/philanthropy/Images/BlueSkyLarge.jpg", UriKind.Absolute);
System.Windows.Media.Imaging.BitmapImage bi = new System.Windows.Media.Imaging.BitmapImage();
bi.UriSource = imageUri;
m_Image.Source = bi;
m_Image.ImageOpened += new EventHandler<RoutedEventArgs>(Image_Opened);
The callback function (Image_Opened) is never called either..
Is your Silverlight application running from the domain php.scripts.psu.edu? If not, Silverlight will block access to it because it will not allow TCP requests made to any domain other than the one the application was loaded from.
See here for network restrictions in Silverlight.
EDIT: commenter is right. It’s the cross-zone issue you’re seeing now. Here’s a link with a table indicating what an Image (among others) can and can’t do.