Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. Display Images dynamically at runtime from a web site

Display Images dynamically at runtime from a web site

Scheduled Pinned Locked Moved ASP.NET
csharpasp-netdotnetcomsysadmin
5 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Eagle32
    wrote on last edited by
    #1

    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,

    N 1 Reply Last reply
    0
    • E Eagle32

      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,

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      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

      E 1 Reply Last reply
      0
      • N Not Active

        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

        E Offline
        E Offline
        Eagle32
        wrote on last edited by
        #3

        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,

        N 1 Reply Last reply
        0
        • E Eagle32

          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,

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          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

          E 1 Reply Last reply
          0
          • N Not Active

            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

            E Offline
            E Offline
            Eagle32
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups