Reputation: 3
@{
Layout = null;
string dosyaYolu = Server.MapPath("~/Views/Home/Adsiz.jpg");
}
<img src="@dosyaYolu" />
I could not display image from dosyaYolu path.What will I need to do?
Upvotes: 0
Views: 3988
Reputation: 855
Please just the pass the URL as itself. Because Server.MapPath will change the URL which can understandable by machine not by the browser.
It will be useful when the image file is inside of the your application.
Just pass the URL as
@{
Layout = null;
var dosyaYolu = @Url.Content("~/Views/Home/Adsiz.jpg");
}
<img src="@dosyaYolu" />
Upvotes: 1