ZekeLA
asked on
ASP.NET database image handler doesn't display ICO image format
I'm storing my images in a sql 2008 database as varbinary(max) and displaying them on my web page using an httphandler. The httphandler does the following:
I use the following markup to display the image:
The code works fine for PNG but not for ICO. I know the web site can display ICO file extensions since I was originally storing the files on web server disk drive and displaying them normally (ImageUrl='~/images/MyIcon .ico').
Do I need a different content type than ico to display those file types?
Thanks in advance.
context.Response.ContentType = dr("Filetype").ToString()
context.Response.BinaryWrite(DirectCast(dr("File"), Byte()))
where Filetype is the file extension. For example, GIF, JPG, PNG, ICO.I use the following markup to display the image:
<asp:Image ID="Image1" runat="server" ImageUrl="~/HttpHandlers/DBImageHandler.ashx?fileid=11" />
The code works fine for PNG but not for ICO. I know the web site can display ICO file extensions since I was originally storing the files on web server disk drive and displaying them normally (ImageUrl='~/images/MyIcon
Do I need a different content type than ico to display those file types?
Thanks in advance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.