ASP.NET MVC生成静态页面的方法(2)

[MyFirstHome] public ActionResult Index() { View_Home view_Home = null; var IsStaticHtml = Convert.ToBoolean(Session["IsStaticHtml"]); if (!IsStaticHtml) { view_Home = new View_Home(); using (BangLiEntities bangLi = new BangLiEntities()) { view_Home.CommandAdExtendList = Dal.CommandAdDal.Instance(bangLi).GetInit().ToList(); view_Home.NewsExtendList = Dal.NewsDal.Instance(bangLi).GetInit().OrderByDescending(u => u.AddDateTime).Take(5).ToList(); } return View(view_Home); } else { return null; } }

说明:可以让一个超链接或跳转地址直接跳转到一个html的静态页面,速度会更快;

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wdpszg.html