I have images stored in my database table and looking to read from the database and output these images in my asp.net page. Does anyone have any suggestions or tips for doing this?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You should create an ashx handler. Then in your page output insert some tag
<img src="yourhandler.ashx?id=yourid" ..>In the handler class you read the image from the DB and stream down to the client with Response.Write. Remember to set the content type properly.Here an example: http://www.developerfusion.com/code/5223/using-ashx-files-to-retrieve-db-images/. As soon you have a first version working, you probably need to improve it by adding some cache handling, but let’s start creating the handle 🙂