c# - How to load image in image control of ASP.NET from database? -


i have created new folder in project , save images in folder. store path in database.

now want load image in asp.net image control unable so.

here code storing path.

if (imgupload.hasfile) {     string filename = imgupload.filename;     string filepath = server.mappath("~/images/facultypics/");     int filelength = imgupload.postedfile.contentlength;     string fileextention = path.getextension(filename);     fileextention = fileextention.tolower();     string link = "~/images/facultypics/" + filename;   //this link stored in database     if (filelength < 1048576)     {         if (fileextention == ".jpg" || fileextention == ".png" || fileextention == ".gif" || fileextention == ".bmp")         {             imgupload.saveas(filepath + filename);             bal.pic = link;         }         else         {             lblmessage.text = "only image files allowed";         }     }     else     {         lblmessage.text = "max file size allowed 1 mb";     } } 

img asp.net image control not showing image.

img.imageurl = page.resolveurl(dt.rows[0][7].tostring()); 

check how path resolved aspx page based on application structure (your application folders structure)


Popular posts from this blog