Skip to content Skip to sidebar Skip to footer

How To Get Particular Image From The Database?

I have an image control on the aspx page like this Copy

add this in config:

<httpHandlers><addverb="*"path="img/*"type="SideImageHandler"/></httpHandlers>

and in handler:

publicvoidProcessRequest (HttpContext context) 
    { 
          int ID;
          if (context.Request.QueryString["ID"] != null)
               ID= Convert.ToInt32(context.Request.QueryString["ID"]);
          elsethrownew ArgumentException("No parameter specified");

        byte[] imageData= ;//get the image data from the database using the employeeId Querystring
        Response.ContentType = "image/jpeg";
        Response.BinaryWrite(imageData);

    } 

Post a Comment for "How To Get Particular Image From The Database?"