Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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();
        }
Ejemplo n.º 3
0
        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());
        }
Ejemplo n.º 4
0
        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());
        }