My suggestion is as follows:
1. From the details, it seems that your image is stored as a blob(binary data) in database table.
2. Instead of fetching the blob(binarydata) and passing it to the next page, you can just pass the database ID to the next page.
3. On the next page, make an AJAX request to the .NET server side code (you can put this on page load) and fetch the blob based on the database ID received from the previous page.
4. Then display this image and load it in the HTML div
or img
tag using the javascript success callback of the ajax request.
By the way, it is recommended to always store images on a filesystem. If you can refactor your server side code to store the images in a directory structure - that would be ideal. It may take lot of changes to your code base.
If the images are not too big - you may continue with the existing approach with the solution I suggested. Generally, having large binary data in database tables - could in long term make the queries slower.
You may want to check how to set binary data fetched as an image and set it in html. Please check this link for details: Is it possible to put binary image data into html markup and then get the image displayed as usual in any browser?