locked
HttpHandler - image retrieval from database - content on page disappearing after implementation RRS feed

  • Question

  • User1859559318 posted
    I am trying to implement a HttpHandler in order to retrieve an image from a database.  I have two problems:
    1) The line

    imageID = context.Request.QueryString("ImageID")

    is not retrieving the query string from aspx page where I have an img tag such as <img src
    ="PersonMain.aspx?ImageID=198274"/>

    2) If I hard code the imageID instead of retrieving it from the query string I can get it to display the image, however, NONE of the other content on the page is displaying.  I assume this has something to do with the HttpHandler, however, my knowledge in this area is limited.

    Any help is always greatly appreciated.

    Regards,
    Lance

    Wednesday, August 10, 2005 12:04 AM

All replies

  • User704942467 posted

    Post your <httpHandlers> section of your web.config file.  I am thinking it is wired up incorrectly.  Also post your definition of your httphandler.  ie:

    namespace WebApp1
    {
       public class ImageHandler : IHttpHandler
    }


    bill

    Wednesday, August 10, 2005 12:07 PM
  • User1859559318 posted

    http://student.cqu.edu.au/~s0012134/ImageTest.zip  is a zip file containing all relevant information, thanks for your time :)

    Lance

    Sunday, August 14, 2005 7:16 PM
  • User704942467 posted
    Pulled it down and looked through your source.  It seems you only issue is you have custom handler that is "colliding" with the standard Page Handler.

    In your web.config try changing

    <add verb="*" path="ImageTest.aspx" type="Feral.ImageHandlerVB"/>

    to

    <add verb="*" path="ImageTest.axd" type="Feral.ImageHandlerVB"/>

    And in your ImageTest.aspx, you can change your link from

    <img src="ImageTest.aspx?ImageID=198274"/>  

    to

    <img src="ImageTest.axd?ImageID=198274"/>

    Let me know how this turns out for you.

    bill
    Monday, August 15, 2005 12:05 PM