Retrieving an image from a SQL Server database in vb.net using a http handler
I'm currently battling to retrieve an image from SQL Server 2008 R2 开发者_如何学JAVAin an asp web application using vb.net. The image is stored in the SQL Server 2008 R2 database as an image type. I've been researching for the past few days and can't seem to find anything solid on this topic. Apparently, the image has to be retrieved using a http handler, and then then image control's imageurl property needs to reference that?
What kind of item needs to be added to the project for this .ashx page?
Please can someone post me some code for both the http handler and the aspx page using vb.net.
Thanks in advance
You don't have to use a HTTP handler - there are other ways to do this. But using an HTTP handler is an elegant and quite nice way to achieve this.
Read these resources - they should you step-by-step how to achieve this:
- Serving Dynamic Content with HTTP Handlers
- Displaying images in ASP.NET using HTTP handlers
精彩评论