Question : Asp.Net: Help-I am passing a querystring to ShowImage.ashx of a Picture in ImageData1. It is being reconized as a is reconized as a 'System.Byte[]'


I am passing a querystring to ShowImage.ashx of a Picture in ImageData1

<img alt="httpHandler" src="ShowImage.ashx?Picture='<%# Eval("ImageData1")%>'">

the problem is it ImageData1 is reconized as a 'System.Byte[]' meaning that it is still in a pack mode and needs to be streamed.

ShowImage.ashx?Picture='System.Byte[]'

------------------------------------------------------------------------------------------------------------
ShowImages.ashx code is in the code block and it needs correcting in order to unpack ImageData Binary Image Data to a displayable Image. I am stuck I donot no how....See Image also.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
public void ProcessRequest (HttpContext context)
   {

         Response.ContentType = "image/jpeg"
         Response.Expires = 0
         Response.Buffer = True
         Response.Clear()
         string v = Request.QueryString["Picture"];
         respone.write("test: " + v)
         Response.BinaryWrite(CType(Request.QueryString("Picture"), Byte())
         HttpContext.Current.ApplicationInstance.CompleteRequest()

    }

}
Attachments:
 
Image is it showed
Image is it showed
 

Answer : Asp.Net: Help-I am passing a querystring to ShowImage.ashx of a Picture in ImageData1. It is being reconized as a is reconized as a 'System.Byte[]'

Your architecture needs improvement. It looks like you are trying to send the contents of an image as a query string parameter down to the client, then have the client send it back to the server in a handler request, which then sends it back to the client as an image. This is terribly inefficient, since each image is passed down to the browser twice and sent back to the server once.

Instead, just send the image ID down to the client, like this:

<img  alt="httpHandler" src="ShowImage.ashx?PictureId='<%#  Eval("ImageId")%>'">

Then, in your handler, use the ID to look up the image in the database and send it to the browser.
Random Solutions  
 
programming4us programming4us