コード例 #1
0
ファイル: default.aspx.cs プロジェクト: jraghu24/Rraghu
        protected override void OnInit(EventArgs e)
        {
            base.OnInit(e);

            //This is only here for legacy if people arent' using master pages...
            //TODO: We need to test that this still works!! Or do we ??
            if (!UmbracoSettings.UseAspNetMasterPages)
            {
                var args = new RequestInitEventArgs()
                {
                    Page    = _upage,
                    PageId  = _upage.PageID,
                    Context = Context
                };
                FireBeforeRequestInit(args);

                //if we are cancelling then return and don't proceed
                if (args.Cancel)
                {
                    return;
                }

                var pageHolder = new umbraco.layoutControls.umbracoPageHolder
                {
                    ID = "umbPageHolder"
                };
                Page.Controls.Add(pageHolder);
                _upage.RenderPage(_upage.Template);
                var umbPageHolder = (layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
                umbPageHolder.Populate(_upage);

                //fire the init finished event
                FireAfterRequestInit(args);
            }
        }
コード例 #2
0
        protected override void OnInit(EventArgs e)
        {
            using (DisposableTimer.DebugDuration <UmbracoDefault>("Init"))
            {
                base.OnInit(e);

                //This is a special case for webforms since in some cases we may be POSTing to an MVC controller, adding TempData there and then redirecting
                // to a webforms handler. In that case we need to manually clear out the tempdata ourselves since this is normally the function of the base
                // MVC controller instance and since that is not executing, we'll deal with that here.
                //Unfortunately for us though, we can never know which TempDataProvider was used for the previous controller, by default it is the sessionstateprovider
                // but since the tempdataprovider is not a global mvc thing, it is only a per-controller thing, we can only just assume it will be the sessionstateprovider
                var provider = new SessionStateTempDataProvider();
                //We create a custom controller context, the only thing that is referenced from this controller context in the sessionstateprovider is the HttpContext.Session
                // so we just need to ensure that is set
                var ctx = new ControllerContext(new HttpContextWrapper(Context), new RouteData(), new TempDataController());
                provider.LoadTempData(ctx);

                //This is only here for legacy if people arent' using master pages...
                //TODO: We need to test that this still works!! Or do we ??
                if (!UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages)
                {
                    var args = new RequestInitEventArgs()
                    {
                        Page    = _upage,
                        PageId  = _upage.PageID,
                        Context = Context
                    };
                    FireBeforeRequestInit(args);

                    //if we are cancelling then return and don't proceed
                    if (args.Cancel)
                    {
                        return;
                    }

                    var pageHolder = new umbraco.layoutControls.umbracoPageHolder
                    {
                        ID = "umbPageHolder"
                    };
                    Page.Controls.Add(pageHolder);
                    _upage.RenderPage(_upage.Template);
                    var umbPageHolder = (layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
                    umbPageHolder.Populate(_upage);

                    //fire the init finished event
                    FireAfterRequestInit(args);
                }
            }
        }
コード例 #3
0
        protected override void OnInit(EventArgs e)
        {
            using (DisposableTimer.DebugDuration<UmbracoDefault>("Init"))
            {

                base.OnInit(e);

                //This is only here for legacy if people arent' using master pages... 
                //TODO: We need to test that this still works!! Or do we ??
                if (!UmbracoConfig.For.UmbracoSettings().Templates.UseAspNetMasterPages)
                {
                    var args = new RequestInitEventArgs()
                                   {
                                       Page = _upage,
                                       PageId = _upage.PageID,
                                       Context = Context
                                   };
                    FireBeforeRequestInit(args);

                    //if we are cancelling then return and don't proceed
                    if (args.Cancel) return;

                    var pageHolder = new umbraco.layoutControls.umbracoPageHolder
                                         {
                                             ID = "umbPageHolder"
                                         };
                    Page.Controls.Add(pageHolder);
                    _upage.RenderPage(_upage.Template);
                    var umbPageHolder = (layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
                    umbPageHolder.Populate(_upage);

                    //fire the init finished event
                    FireAfterRequestInit(args);
                }
            }
        }
コード例 #4
0
        private void initUmbracoPage()
        {
            RequestInitEventArgs e = new RequestInitEventArgs();

            e.Page = m_umbPage;

            if (m_umbPage != null)
            {
                e.PageId = m_umbPage.PageID;
            }

            e.Context = System.Web.HttpContext.Current;

            FireBeforeRequestInit(e);
            if (!e.Cancel)
            {
                if (!UmbracoSettings.EnableSplashWhileLoading || !content.Instance.isInitializing)
                {
                    if (m_umbPage != null)
                    {
                        // Add page elements to global items
                        try
                        {
                            System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
                        }
                        catch (ArgumentException)
                        {
                            System.Web.HttpContext.Current.Items.Remove("pageElements");
                            System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
                        }

                        string tempCulture = m_umbPage.GetCulture();
                        if (tempCulture != "")
                        {
                            System.Web.HttpContext.Current.Trace.Write("default.aspx", "Culture changed to " + tempCulture);
                            System.Threading.Thread.CurrentThread.CurrentCulture =
                                System.Globalization.CultureInfo.CreateSpecificCulture(tempCulture);
                            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
                        }

                        if (!UmbracoSettings.UseAspNetMasterPages)
                        {
                            layoutControls.umbracoPageHolder pageHolder = new umbraco.layoutControls.umbracoPageHolder();
                            pageHolder.ID = "umbPageHolder";
                            Page.Controls.Add(pageHolder);
                            m_umbPage.RenderPage(m_umbPage.Template);
                            layoutControls.umbracoPageHolder umbPageHolder =
                                (layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
                            umbPageHolder.Populate(m_umbPage);
                        }
                    }
                    else
                    {
                        // If there's no published content, show friendly error
                        if (umbraco.content.Instance.XmlContent.SelectSingleNode("/root/*") == null)
                        {
                            Response.Redirect(IO.SystemDirectories.Config + "/splashes/noNodes.aspx");
                        }
                        else
                        {
                            GenerateNotFoundContent();
                        }
                    }
                }
                else
                {
                    Response.Redirect(IO.SystemDirectories.Config + "/splashes/booting.aspx?orgUrl=" + Request.Url);
                }

                FireAfterRequestInit(e);
            }
        }
コード例 #5
0
ファイル: default.aspx.cs プロジェクト: jracabado/justEdit-
        private void initUmbracoPage()
        {
            RequestInitEventArgs e = new RequestInitEventArgs();
            e.Page = m_umbPage;

            if(m_umbPage != null)
                e.PageId = m_umbPage.PageID;

            e.Context = System.Web.HttpContext.Current;

            FireBeforeRequestInit(e);
            if (!e.Cancel)
            {
                if (!UmbracoSettings.EnableSplashWhileLoading || !content.Instance.isInitializing)
                {

                    if (m_umbPage != null)
                    {
                        // Add page elements to global items
                        try
                        {

                            System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);

                        }
                        catch (ArgumentException aex)
                        {

                            System.Web.HttpContext.Current.Items.Remove("pageElements");
                            System.Web.HttpContext.Current.Items.Add("pageElements", m_umbPage.Elements);
                        }

                        string tempCulture = m_umbPage.GetCulture();
                        if (tempCulture != "")
                        {
                            System.Web.HttpContext.Current.Trace.Write("default.aspx", "Culture changed to " + tempCulture);
                            System.Threading.Thread.CurrentThread.CurrentCulture =
                                System.Globalization.CultureInfo.CreateSpecificCulture(tempCulture);
                            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Threading.Thread.CurrentThread.CurrentCulture;
                        }

                        if (!UmbracoSettings.UseAspNetMasterPages)
                        {
                            layoutControls.umbracoPageHolder pageHolder = new umbraco.layoutControls.umbracoPageHolder();
                            pageHolder.ID = "umbPageHolder";
                            Page.Controls.Add(pageHolder);
                            m_umbPage.RenderPage(m_umbPage.Template);
                            layoutControls.umbracoPageHolder umbPageHolder =
                                (layoutControls.umbracoPageHolder)Page.FindControl("umbPageHolder");
                            umbPageHolder.Populate(m_umbPage);
                        }

                    }
                    else
                    {
                        // If there's no published content, show friendly error
                        if (umbraco.content.Instance.XmlContent.SelectSingleNode("/root/*") == null)
                            Response.Redirect(IO.SystemDirectories.Config + "/splashes/noNodes.aspx");
                        else
                        {

                            GenerateNotFoundContent();
                        }
                    }
                }
                else
                {
                    Response.Redirect(IO.SystemDirectories.Config + "/splashes/booting.aspx?orgUrl=" + Request.Url);
                }

                FireAfterRequestInit(e);
            }
        }