Display Images dynamically at runtime from a web site
-
Hi, I have search facility on my web site. I am using .NET framework 3.5 with ASP.NET C# and I would like to display an image on the page. The image i am retrieving is directly from a web site e.g http://somewebsite.com/images/image1.jpg I am trying to use the control and tried to set the Image URL to the web address but it doesnt work. I know how to display the image from a web server when using Windows Form by using system.Net and using http requests but i dont know how to go about implementing this in web site. I would appreciate if somebody could assist me with this? Thanks,
-
Hi, I have search facility on my web site. I am using .NET framework 3.5 with ASP.NET C# and I would like to display an image on the page. The image i am retrieving is directly from a web site e.g http://somewebsite.com/images/image1.jpg I am trying to use the control and tried to set the Image URL to the web address but it doesnt work. I know how to display the image from a web server when using Windows Form by using system.Net and using http requests but i dont know how to go about implementing this in web site. I would appreciate if somebody could assist me with this? Thanks,
How are you setting the image? Setting the src property for the image tag is all that is necessary.
I know the language. I've read a book. - _Madmatt
-
How are you setting the image? Setting the src property for the image tag is all that is necessary.
I know the language. I've read a book. - _Madmatt
I am using control and I am setting the image URL to the web address like this:
String webURL = System.Net.HttpWebRequest.Create(Title.ImageUri.OriginalString).GetResponse().GetResponseStream().ToString()
Image1.ImageURL = webURL;if i view the source then the src is set to this which is wrong:
img id="ctl00_ContentPlaceHolder1_Image1" src="System.Net.ConnectStream" alt="DVD" style="height:122px;width:122px;border-width:0px;margin-left: 73px" />
Any advice on the above? Thanks,
-
I am using control and I am setting the image URL to the web address like this:
String webURL = System.Net.HttpWebRequest.Create(Title.ImageUri.OriginalString).GetResponse().GetResponseStream().ToString()
Image1.ImageURL = webURL;if i view the source then the src is set to this which is wrong:
img id="ctl00_ContentPlaceHolder1_Image1" src="System.Net.ConnectStream" alt="DVD" style="height:122px;width:122px;border-width:0px;margin-left: 73px" />
Any advice on the above? Thanks,
What you are doing is assigning the ImageUrl property the type name, System.Net.ConnectStream, because you are calling ToString() on the Stream object returned from GetResponseStream(). Why did you even think this was necessary or the proper way? Title.ImageUri.OriginalString is all you need.
I know the language. I've read a book. - _Madmatt
-
What you are doing is assigning the ImageUrl property the type name, System.Net.ConnectStream, because you are calling ToString() on the Stream object returned from GetResponseStream(). Why did you even think this was necessary or the proper way? Title.ImageUri.OriginalString is all you need.
I know the language. I've read a book. - _Madmatt
Hi, Yes your right, i only need to specify the OriginalString part. I solved the problem by using the debugger after i replied to your previous message. When i was developing a Windows Form application I was using HTTpRequests etc and assigning the values to a picture box. Thanks for the help.