4
Answers

More than one Image displaying using Http handler

Resmi Satish

Resmi Satish

11y
1k
1
I am having a handler page which has been used for displaying images.When I have to display a single image ,every thing is working fine.

Please find below my code:

                      byte[] imgReceipt;//Contains the image to display which will be fetched from database.

                            MemoryStream stream = new MemoryStream(imgReceipt);


                            if (stream.Length > 1)
                            {
                                context.Response.ContentType = contentType;
                                context.Response.Cache.SetCacheability(HttpCacheability.Public);
                                context.Response.BufferOutput = false;

                                const int buffersize = 1024 * 16;
                                byte[] buffer = new byte[buffersize];
                                int count = stream.Read(buffer, 0, buffersize);
                                while (count > 0)
                                {
                                    context.Response.OutputStream.Write(buffer, 0, count);
                                    count = stream.Read(buffer, 0, buffersize);
                                }
                            }

How we can display more than one image using the above code?

I am displaying the image in a new page so that next image should load when we click the next button in window picture viewer.
                      
             

Answers (4)