Last Articles

Unable to find root of image URL in View in ASP.NET MVC

I have added a Uploads folder and an image file in my ASP.NET MVC project


I have used @Model.ProfileImage as shown below, but it is not working.


<img id="blah" src="@Model.ProfileImage" alt="User Image">


20220626_unable_to_find_root_for_img_aspnetmvc_1


Solution : After I applied the Url.Content method, it is working fine


<img id="blah" src="@Url.Content(Model.ProfileImage)" alt="User Image">


20220626_unable_to_find_root_for_img_aspnetmvc_2