public void ShowHomePage() { // 先输出页框架 ResponseWriter.WritePage(null /* pageVirtualPath */, null /* model */, true /* flush */); string appRootPath = this.WebRuntime.GetWebSitePath(); BlogBLL bll = new BlogBLL(); // 加载博客内容,第一个数据 string blogFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\BlogBody.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/BlogBody.ascx", bll.GetBlog(blogFilePath), "blog-body", true); // 加载左链接导航栏,第二个数据 string linksFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\Links.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/TagLinks.ascx", bll.GetLinks(linksFilePath), "right", true); // 加载评论,第三个数据 string commentFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\Comments.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/CommentList.ascx", bll.GetComments(commentFilePath), "blog-comments-placeholder", true); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/PageEnd.ascx", null /* model */, true /* flush */); }
public void ShowHomePage() { // 先输出页框架 this.WritePage(null /* pageVirtualPath */, null /* model */, true /* flush */); BlogBLL bll = new BlogBLL(); // 加载博客内容,第一个数据 string blogFilePath = Path.Combine(HttpContextHelper.AppRootPath, "App_Data\\BlogBody.txt"); this.WriteCacheUserControl("~/UserControls/BlogBody.ascx", () => bll.GetBlog(blogFilePath), "blog-body", true); // 加载左链接导航栏,第二个数据 string linksFilePath = Path.Combine(HttpContextHelper.AppRootPath, "App_Data\\Links.txt"); this.WriteCacheUserControl("~/UserControls/TagLinks.ascx", () => bll.GetLinks(linksFilePath), "right", true); // 加载评论,第三个数据 string commentFilePath = Path.Combine(HttpContextHelper.AppRootPath, "App_Data\\Comments.txt"); this.WriteCacheUserControl("~/UserControls/CommentList.ascx", () => bll.GetComments(commentFilePath), "blog-comments-placeholder", true); this.WriteUserControl("~/UserControls/PageEnd.ascx", null /* model */, true /* flush */); //return View("~/UserControls/CommentList.ascx", bll.GetComments(commentFilePath)); }
public void ShowHomePage() { // 先输出页框架 ResponseWriter.WritePage(null /* pageVirtualPath */, null /* model */, true /* flush */); string appRootPath = this.MvcRuntime.GetWebSitePath(); BlogBLL bll = new BlogBLL(); // 加载博客内容,第一个数据 string blogFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\BlogBody.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/BlogBody.ascx", bll.GetBlog(blogFilePath), "blog-body", true); // 加载左链接导航栏,第二个数据 string linksFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\Links.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/TagLinks.ascx", bll.GetLinks(linksFilePath), "right", true); // 加载评论,第三个数据 string commentFilePath = Path.Combine(appRootPath, "App_Data\\BigPipe\\Comments.txt"); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/CommentList.ascx", bll.GetComments(commentFilePath), "blog-comments-placeholder", true); ResponseWriter.WriteUserControl("~/BigPipe/UserControls/PageEnd.ascx", null /* model */, true /* flush */); }