0

I have an odd issue. I simplified what I my issue is.

Within my _Layout.cshtml, I have the following code. The image shows up fine.

<img src="~/Content/images/draw.png" />

Instead, if I replace it with the following:

 @Html.Action("RetrieveLogo", "Info")

And do the following:

    public string RetreiveLogo()
    {
        return $"<img src=\"~/Content/images/draw.png\"/>";
    }

The image does not show up. I see it hitting RetreiveLogo and returning the value. It does not show the image though.

As mentioned, what I have above is simplified as my content is more dynamic than this. Any assistance would be appreciated.

Nate Pet
  • 44,246
  • 124
  • 269
  • 414
  • a see [link](https://stackoverflow.com/questions/3627178/how-to-insert-image-in-html-action-link-asp-net-mvc) – A.R.SEIF Oct 16 '20 at 18:39

1 Answers1

1

You could try something like this:

public ActionResult RetreiveLogo()
{
    return PartialView("<img src=\"~/Content/images/draw.png\"/>");
}
Adlorem
  • 1,457
  • 1
  • 11
  • 10