标签:
以下为MVC5缓存Index页面实例:
控制器代码:
[OutputCache(Duration = 20)]//给index添加10秒缓存 OutputCache:给index添加的缓存标签
public ActionResult Index()
{
ViewBag.Time2 = DateTime.Now.ToLongTimeString();
IQueryable<M_MappingTable> m = _mappingTableService.download();
return View(m);
}
视图代码:
@using (Html.BeginForm("Upload", "Home", FormMethod.Post, new { enctype = "multipart/form-data" }))
{
<text>选择上传文件:</text><input name="file" type="file" id="file" />
<br />
<br />
<input type="submit" name="Upload" value="Upload" />
}
<div class="bar2"><h2>@ViewBag.Time2</h2></div>
标签:
原文地址:http://www.cnblogs.com/AndyCf/p/5112801.html