PDA

Click to See Complete Forum and Search --> : [RESOLVED] Silverlight External Image


ntg
Aug 8th, 2009, 02:13 PM
I'm trying to dynamically load an image into an Image control using code. As long as the image resides within the Silverlight solution, all is well. However, when the image resides outside the solution I get an AG_E_NETWORK_ERROR error.

Note: the image I'm trying to load resides in a UNC share (\\server\share\image1.jpg) and not on another web server.

ngreenwood6
Aug 12th, 2009, 02:08 PM
Just a question but did you try adding it through the image popup box for an image control. What I mean by that is did you try and get it to show up by adding an image control then click the ... button and browse for the image through the share. The reason I ask this is because it may not be available. However, if it does work like that take a look at the code that it created to do it and just duplicate it in code.

ntg
Aug 12th, 2009, 02:41 PM
Doesn't work that way. If you browse for the image, it adds it to the project resources and you refer to it directly. Otherwise, I can add an external absolute http reference easily. It's the local network, UNC reference I can't figure out.

ngreenwood6
Aug 12th, 2009, 03:17 PM
oh yeah i forgot about it loading it as a reference lol (long day). Have you tried connecting to is using the ip address? if you dont know it you can ping the machine.

ntg
Aug 12th, 2009, 03:28 PM
I know the machine and its IP address, that's not the problem. What I can't see how to achieve is dynamically bound the source of an image to an existing image shared in the network.

For example, with HTML you'd use an IMG tag with something like this:
<IMG src="file://server/share/image1.png">
Can you do the same with Silverlight dynamically?

ngreenwood6
Aug 12th, 2009, 03:33 PM
This is a quote from the silverlight forums:


Silverlight doesn't allow arbitrary access to the file system or shares.


If you are running a website on the server I would suggest just putting the file somewhere you can access it from the server and then point it to that location in your silverlight app.

ntg
Aug 12th, 2009, 03:42 PM
:down: Super. :down:

It's small things like that that turn me down. I'm willing to bet that the workaround would be to communicate between Silverlight and Javascript and have a client-side js dynamically load the image into a frame. Another level of indirection and (again) Javascript proves to be king of the hill.