Hi all I am binding the img tag as follows
"" src='@Url.Action("UserImage", "Home")' class="avatar img-circle img-thumbnail" />
This is my code to get the image from the database
- [HttpGet]
- public ActionResult UserImage()
- {
- string user = Session["UserName"] as string;
- byte[] photo = null;
- var v = db.table.Where(p => p.USER_NAME == user).Select(img => img.PHOTO).FirstOrDefault();
- if (v != null)
- {
- photo = v;
- return File(photo, "image/jpeg");
- }
- else
- return null;
- }
This is displaying image when I have in the database but when it is null it is displaying as follows, instead of that i need to bind src tag with empty

Saineshwar BageriRank #115 · 19.6K reputationPosted Feb 7, 2016, 8:10 PM EST
Cassie ModRank #3,821 · 387 reputationPosted Feb 9, 2016, 6:32 AM EST