views:

1045

answers:

3

Hi, i'm developing an application and i would load an image that isn't in the clientbin folder, but in a folder placed in my server. I would do something like this BitmapImage bit = new BitmapImage(); string path = "c:/image.png"; bit.UriSource = new Uri(path, UriKind.Absolute); identity.Source = bit; but it doesn't function.Any idea? Thanks

+1  A: 

Try:

Image.Source = New Imaging.BitmapImage(New Uri("http://www.Pic.jpg", UriKind.Absolute))

You do not want to include it in your project or the .xap will get huge.

Bill
A: 

i don't want to retrieve an image from a site, but from a a fold in the server, for example C:..\image.png

Image.Source = New Imaging.BitmapImage(New Uri("Images/Pic.jpg", UriKind.Relative))Have a folder Images as a sub folder off of your bin folder.
Robert Kozak
A: 

Silverlight applications run on the client, not on the server, so referencing the path as you had been trying to do, would really point to the path on client machine running the application. However, Silverlight does not have rights to read or write from or to the client's disk anyway, due to sercurity reasons. The Isolated Storage functionality is the exception to that.

Therefore, your option is to try the first answer given by Bill, or a WebService, which is more complex to implement.

ib.

Ireney Berezniak