Try it like this:
public ActionResult ShowImage() { var file = Server.MapPath("~/App_Data/UserUpload/asd.png"); return File(file, "image/png", Path.GetFileName(file)); }
or if you want to create a separate file name:
public ActionResult ShowImage() { var path = Server.MapPath("~/App_Data/UserUpload"); var file = "asd.png"; var fullPath = Path.Combine(path, file); return File(fullPath, "image/png", file); }
Darin Dimitrov
source share