First and foremost I am new to MVC, so I have a learning curve.
After reading the following post - Display image from database in asp mvc
I have included in the _Layout.cshtml
the following markup and razor per the post above
<img src="@Url.Action("show", "image", new { imageName = Session["WebSite.LogoFileName"]})" />
The shared view _Layout.cshtml is calling the HomeController which has
[AllowAnonymous]
public ActionResult Index()
{
return View();
}
From what I understand in the post I included the following in the HomeController as well.
[AllowAnonymous]
public ActionResult Show()
{
return View();
}
The image controller has the following
// GET: /Image/
public ActionResult Show(string imageName)
{
var imageData = ReadBytesFromDatabase(Session["WebSite.LogoFileName"].ToString());
return File(imageData, "image/jpg"); //I have excluded the File method on purpose.
}