本文整理汇总了C#中WebPage.ExecutePageHierarchy方法的典型用法代码示例。如果您正苦于以下问题:C# WebPage.ExecutePageHierarchy方法的具体用法?C# WebPage.ExecutePageHierarchy怎么用?C# WebPage.ExecutePageHierarchy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage.ExecutePageHierarchy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RenderWebPage
public static string RenderWebPage(WebPage page, StartPage startPage = null, HttpRequestBase request = null)
{
var writer = new StringWriter();
// Create an actual dummy HttpContext that has a request object
var filename = "default.aspx";
var url = "http://localhost/default.aspx";
request = request ?? CreateTestRequest(filename, url).Object;
var httpContext = CreateTestContext(request);
var pageContext = new WebPageContext { HttpContext = httpContext.Object };
page.ExecutePageHierarchy(pageContext, writer, startPage);
return writer.ToString();
}
示例2: RenderWebPage
public static string RenderWebPage(WebPage page, StartPage startPage = null) {
var writer = new StringWriter();
// Create an actual dummy HttpContext that has a request object
var filename = "default.aspx";
var url = "http://localhost/default.aspx";
var request = new HttpRequest(filename, url, null);
var httpContext = new HttpContext(request, new HttpResponse(new StringWriter(new StringBuilder())));
var pageContext = Util.CreatePageContext(httpContext);
page.ExecutePageHierarchy(pageContext, writer, startPage);
return writer.ToString();
}