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

Last post 08-15-2005 12:05 PM by billrob458. 3 replies.

Sort Posts:

  • HttpHandler - image retrieval from database - content on page disappearing after implementation

    08-10-2005, 12:04 AM
    • Member
      65 point Member
    • lance487
    • Member since 08-10-2005, 2:41 AM
    • Posts 13
    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

  • Re: HttpHandler - image retrieval from database - content on page disappearing after implementation

    08-10-2005, 12:07 PM
    • Contributor
      3,329 point Contributor
    • billrob458
    • Member since 07-24-2003, 10:44 PM
    • New York, NY
    • Posts 671

    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

  • Re: HttpHandler - image retrieval from database - content on page disappearing after implementation

    08-14-2005, 7:16 PM
    • Member
      65 point Member
    • lance487
    • Member since 08-10-2005, 2:41 AM
    • Posts 13

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

    Lance

  • Re: HttpHandler - image retrieval from database - content on page disappearing after implementation

    08-15-2005, 12:05 PM
    • Contributor
      3,329 point Contributor
    • billrob458
    • Member since 07-24-2003, 10:44 PM
    • New York, NY
    • Posts 671
    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
Page 1 of 1 (4 items)