本文整理汇总了C#中Page.Render方法的典型用法代码示例。如果您正苦于以下问题:C# Page.Render方法的具体用法?C# Page.Render怎么用?C# Page.Render使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page.Render方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PageRequest
public PageRequest(Server server, HttpContext context)
{
//the Pipeline.PageRequest is simply the first page request for a Websilk website.
S = new Core(server, context);
var page = new Page(S);
S.isFirstLoad = true;
if (S.isFirstLoad == true)
{
getUserAgent(context);
}
//parse URL
page.Url = page.parseUrl(S.Request.Path.ToString().ToLower().Replace(" ", "-"));
//get page Info
page.getPageInfoFromUrl();
//register initial javascript
S.javascript.Add("init", "S.init(" + (S.User.useAjax ? "true" : "false") + "," + page.pageId + "," + page.pageType + ",'" + page.pagePathName + "','" + page.pageTitle + "','" + page.PageTitleForBrowserTab + "'," + page.websiteId + ",'" + page.websiteTitle + "', '" + (S.Request.IsHttps ? "https://" : "http://") + "','" + page.Url.host + "');");
//render the page
var response = page.Render();
//unload the core (before sending response)
S.Unload();
//render the server response
S.Response.ContentType = "text/html";
S.Response.WriteAsync(response);
}
示例2: Url
public PageRequest Url(string url)
{
if (S.isSessionLost()) { return lostPageRequest(); } //check session
var response = new PageRequest();
if (!string.IsNullOrEmpty(url))
{
var arrUrl = url.Split('\"');
if (arrUrl[0].IndexOf("+") < 0)
{
//found page with no query in url
var page = new Page(S);
//parse URL
page.Url = page.parseUrl(url.ToLower().Replace(" ", "-"));
//get page Info
page.getPageInfoFromUrl();
//load page content
page.Render();
//write to console
Console.WriteLine("Load page: " + page.pageTitle);
//set up response
response.components = new List<PageComponent>();
response.css = "";
response.editor = "";
response.js = "";
response.pageTitle = page.pageTitle;
response.url = url;
response.pageId = page.pageId;
response.already = true;
//load page components, excluding components from the currently loaded page
//render each component for the page
}
}
return response;
}
示例3: RenderPage
public async Task RenderPage(RedwoodRequestContext context, Page page, string serializedViewModel)
{
// set up integration scripts
//var integrationScripts = page.OfType<IntegrationScripts>().Single();
//integrationScripts.SerializedViewModel = serializedViewModel;
//integrationScripts.InternalScriptUrls = new List<string>() {
// context.OwinContext.Request.PathBase + "/Scripts/knockout-3.0.0.js",
// context.OwinContext.Request.PathBase + "/Scripts/knockout.mapping-latest.js",
// context.OwinContext.Request.PathBase + "/Scripts/knockout.validation.js",
// context.OwinContext.Request.PathBase + "/Scripts/Redwood.js",
// context.OwinContext.Request.PathBase + "/Data.js"
//};
// get the HTML
var writer = new HtmlWriter();
page.Render(writer);
var html = writer.ToString();
// return the response
context.OwinContext.Response.ContentType = "text/html; charset=utf-8";
await context.OwinContext.Response.WriteAsync(html);
}