you can use this in code behind to bind image
ProfilePhotoImag.ImageUrl = ~/FetchProfileImage.ashx?Imageid=" + Imageid;
and now create a handler class and write following code
public void ProcessRequest(HttpContext context)
{
try
{
if (context.Request.QueryString["Imageid"] != null)
{
Imageid= int.Parse(context.Request.QueryString["Imageid"]);
}
context.Response.ContentType = "image/jpeg";
// connecting to database to get byte array which is stored in database
byte[] barrImg = objMBL.GetProfilePhoto(Imageid);
System.IO.Stream strm = new System.IO.MemoryStream(barrImg);
int byteSeq = strm.Read(barrImg, 0, barrImg.Length);
while (byteSeq > 0)
{
context.Response.OutputStream.Write(barrImg, 0, byteSeq);
byteSeq = strm.Read(barrImg, 0, barrImg.Length);
}
}
SIVA PRASAD ADIRAJU
Gokul, if this helps please login to Mark As Answer. | Alert Moderator