ASP.Net MVC feed does not show



  • I've got some kind of OD that has different pictures. The page does not show the image when the application works. This is View code:

    @using (Html.BeginForm())
    {
    <div>
        <p><img src="@Model.imageUrl" alt="@Model.imageUrl"></p>
        <p>@Html.ValidationMessageFor(x => x.hieroglyph) </p>
        <p>Enter hieroglyph: @Html.TextBoxFor(x => x.hieroglyph, new { Value = "" })</p>
        <input type="submit" value="Submit" />
    </div>
    }
    

    But if I show the way manually, everything works.

    <p><img src="~/Content/Images/Hiragana/tsu.jpg"></p>
    

    Here's the control code for anything:

    [HttpGet]
        public ActionResult HiraganaTesting()
        {
            HiraganaRapository hiraganarepos = new HiraganaRapository();
            IEnumerable<Hiragana> listWords = hiraganarepos.GetRandom10HiraganaHieroglyphs();
            return View("HiraganaTesting", listWords.ElementAt(0));
        }
    

    I've got regular strings in the Base, like, nvarchar, like: ~/Content/Images/Hiragana/tsu.jpg♪ When ASP.NET WebForms taught, did something like that and everything worked peacefully. I started teaching MVC, and I ran into this problem. Show me how to get MVC, show the images.



  • You have a mistake to store relative url in the database:

    ~/Content/Images/Hiragana/tsu.jpg
    

    This kind of look is clear to the server, but it's not clear to the client, you should get rid of theda. ~


Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2