视图代码:
@{
ViewBag.Title = "Image";
}
-
@for (int i = 1; i @Url.Action("Image", new { id = "00"+i })
}
``//控制器代码
public class HomeController : Controller
{
//
// GET: /Home/
public ActionResult Index()
{
return View();
}
public ActionResult Image(string id)
{
string path = Server.MapPath("/images/"+id+".jpg");
return File(path, "image/jpeg");
}
}