Can an ASP.NET MVC controller return an Image?
Use the base controllers File method. public ActionResult Image(string id) { var dir = Server.MapPath(“/Images”); var path = Path.Combine(dir, id + “.jpg”); //validate the path for security or use other means to generate the path. return base.File(path, “image/jpeg”); } As a note, this seems to be fairly efficient. I did a test where I requested … Read more