Answered by:
Display image from a public website

Question
-
User1510859543 posted
We are trying to display an image from another website (see image control below) and it is not working. All we get is some default tiny thing or an X where the image should be. I have tried using http prefix as well as file prefix but neither one works. I even tried setting in code-behind. What am I missing?
p.s. the uploads folder is a virtual folder with everyone permissions.
<asp:Image ID="Image1" runat="server" ImageUrl="http://myweb.com/uploads/2201811.jpg" /> or <asp:Image ID="Image1" runat="server" ImageUrl="file:///myweb.com/uploads/2201811.jpg" /> and code-behind Image1.ImageUrl = "http://myweb.com/uploads/2201811.jpg"
Monday, November 19, 2018 7:54 PM
Answers
-
User475983607 posted
Would you use the GetStreamAsynch method?
What I don't understand is why do you want to download the image when you can simply link to the image? And if you own both sites then copy the image to the other site.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 19, 2018 9:03 PM
All replies
-
User475983607 posted
Either the image URL is incorrect or the other site does not allow hot linking.
Monday, November 19, 2018 8:03 PM -
User1510859543 posted
Yes, it was an authorization issue. I added auth credentials to vdir and now it works.
Monday, November 19, 2018 8:08 PM -
User1510859543 posted
Is it possible to stream the image so I can save it?
Monday, November 19, 2018 8:21 PM -
User475983607 posted
dlchase
Is it possible to stream the image so I can save it?
Your question is not clear.
This code snippet...
<asp:Image ID="Image1" runat="server" ImageUrl="http://myweb.com/uploads/2201811.jpg" />
Is simply a URL to the image. The browser does an HTTP GET when it sees the img tg generated from the image server control. You can get the same affect by simply placing the image URL in the browser's address bar. It does not make sense that this was an authentication issue as images are not generally secured unless you are using an Http Handler which is not clear from the code.
Monday, November 19, 2018 8:29 PM -
User1510859543 posted
All I know is that after I added credentials to the virtual directory in IIS the image started displaying.
Regarding streaming...I would like to stream the image from the url and save it to a .jpg file on the calling website. Both websites are ours. Thanks.
Monday, November 19, 2018 8:37 PM -
User475983607 posted
Regarding streaming...I would like to stream the image from the url and save it to a .jpg file on the calling website. Both websites are ours. Thanks.
You want to download an image using C#? I use HttpClient.
Monday, November 19, 2018 8:49 PM -
User1510859543 posted
Would you use the GetStreamAsynch method?
Monday, November 19, 2018 8:55 PM -
User475983607 posted
Would you use the GetStreamAsynch method?
What I don't understand is why do you want to download the image when you can simply link to the image? And if you own both sites then copy the image to the other site.
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Monday, November 19, 2018 9:03 PM -
User1510859543 posted
Yes, the network admin is going to make the images from server1 available to server2 so we can possibly move or copy them from the remote server (server1) to our intranet server (server2).
Monday, November 19, 2018 9:32 PM