<img src="@Url.Action("showimage", "rest", new { id = 1 })" alt="" />
Y en nuestra controladora deberemos declarar la siguiente acción
public ActionResult showimage(int id)
{
var path = Server.MapPath("~/content/image");
var file = string.format("{0}.png", id);
var fullPath = Path.Combine(path, file);
return File(fullPath, "image/png", file);
}
Happy coding!
No hay comentarios:
Publicar un comentario