Click here to Skip to main content
15,881,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to display an image from SQL server to my web page.
Iam following Layered architecture, I got the image on my presentation layer(ASPX.Cs)
like {byte[6317]}

How to convert it into an image on my webpage
Posted
Comments
ZurdoDev 26-Sep-14 7:32am    
There are lots of samples online. Where are you stuck?
MAGuru 26-Sep-14 8:02am    
please give me a link
ZurdoDev 26-Sep-14 8:14am    
google.com

Serious. Just do a little bit of work on your own first. You'll learn more that way.
[no name] 26-Sep-14 7:34am    
use image hander file for this

Thanks a lot for your answers. I appreciate you all. But my problem is the picture is in an asp image control.

i am not using the file uploader. i am saving the image in an image control to database.

That is my problem.

Thanks.
 
Share this answer
 
Hi,

Check the follow link to display image without using generic handler :

http://www.aspsnippets.com/Articles/Display-image-from-database-in-Image-control-without-using-Generic-Handler-in-ASPNet.aspx[^]

Or you can achieve this by using generic handler :

Generic Image Handler Using IHttpHandler[^]
 
Share this answer
 
Refer -
Display Byte Array as Image without using Generic Handler in ASP.Net
[^].

Very simple...
C#
Byte[] bytes = br.ReadBytes((Int32)fs.Length);
string base64String = Convert.ToBase64String(bytes, 0, bytes.Length);
Image1.ImageUrl = "data:image/png;base64," + base64String;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900