Exemplo n.º 1
0
        internal void Execute(string virtualPath, bool endResponse, NameObjectCollection parameters, HtmlTextWriter writer)
        {
            if (virtualPath == null)
            {
                HttpContext.Current.Response.Write(Resources.PageBase_IncludeSrcIsRequired);
                return;
            }

            virtualPath = MakeAbsolutePath(virtualPath);
            virtualPath = UrlUtil.ConvertDots(virtualPath);

            string path = TemplateManager.ParseTemplate(virtualPath);

            if (virtualPath.EndsWith(".aspx", StringComparison.OrdinalIgnoreCase))
            {
                PageBase page = BuildManager.CreateInstanceFromVirtualPath(path, typeof(PageBase)) as PageBase;

                if (page != null)
                {
                    page.Parameters     = parameters;
                    page.HtmlTextWriter = writer;

                    page.ProcessRequest(HttpContext.Current);
                }
            }
            else if (virtualPath.EndsWith(".ascx", StringComparison.OrdinalIgnoreCase))
            {
                if (writer == null)
                {
                    writer = new HtmlTextWriter(new HttpResponseWriter(HttpContext.Current.Response));
                }

                PagePartBase part = m_LoadControlCallback(path) as PagePartBase;

                if (part != null)
                {
                    part.Parameters     = parameters;
                    part.HtmlTextWriter = writer;

                    part.RenderControl(writer);
                }
            }

            if (endResponse)
            {
                HttpContext.Current.Response.End();
            }
        }
Exemplo n.º 2
0
 public ParamVariable(PagePartBase owner)
 {
     m_Owner = owner;
 }