Skip Navigation LinksHome > Categories > Code from a Category

Save resized image and show it on website - part 2 of 2

User Name: jamest85
Name: James Tang
Contact Me:
Home Page:
Google Apps for Work Partner, Certified Zoho CRM Consultant. 7 years experience on Zoho consulting, implementation, and programming using C#, VB, Php..., 15 years of total IT experience including prog... [More]
Viewed Times: 2808
Add Date: 02/19/2010
This second part shows how to get an image from database and show it on a web page by using .ashx WebHandler
In the First part shows how to save a resized image to sql database.
This post shows how to show the image from database to webpage.
Usually there are 2 ways to put images on web page:
1. Upload the image in application folder, then use: 2. Use .ashx WebHandler to get the image (byte[]) from database: Usually I use second option if any image is related to other data. below is the ImagesForCode.ashx file: Below is the function to get image (byte[]) from database Stored Procedure getImgById: The tblImg table looks like this:

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.