protected void Page_Load(object sender, EventArgs e)
        {
            if (DebugInfo.ShowDebugInfo)
            {
                debugInfoPopUpContainer.Options.IsPopup = true;
            }

            if (Page is Auth || Page is _Default)
            {
                CurrentProductID = Guid.Empty;
            }
            else
            {
                CurrentProductID =
                    !String.IsNullOrEmpty(Request["productID"])
                        ? new Guid(Request["productID"])
                        : CommonLinkUtility.GetProductID();

                if (!String.IsNullOrEmpty(Request["moduleID"]))
                {
                    CurrentModuleID = new Guid(Request["moduleID"]);
                }
            }

            CurrentProduct = (IProduct)WebItemManager.Instance[CurrentProductID];

            if (SecurityContext.CurrentAccount.IsAuthenticated && !TenantStatisticsProvider.IsNotPaid())
            {
                Page.RegisterBodyScripts(ResolveUrl("~/UserControls/Common/TopStudioPanel/js/FeedReaderScripts.js"));
            }

            RenderVideoHandlers();

            if (!DisableSearch)
            {
                RenderSearchProducts();
                DisableSearch = DisableSearch || !SearchProducts.Any() || CoreContext.Configuration.YourDocs;
            }

            _guestInfoHolder.Visible = false;
            _userInfoHolder.Visible  =
                (!DisableUserInfo.HasValue || !DisableUserInfo.Value) &&
                SecurityContext.IsAuthenticated &&
                !(Page is Wizard);

            ShowTopPanelNavigation = SecurityContext.IsAuthenticated && !(Page is Wizard);

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            TariffNotify = TenantExtra.GetTariffNotify();
            if (!SecurityContext.IsAuthenticated || !TenantExtra.EnableTarrifSettings || CoreContext.Configuration.YourDocs || CurrentUser.IsVisitor())
            {
                DisableTariffNotify = true;
                DisableTariff       = true;
            }
            else if (string.IsNullOrEmpty(TariffNotify))
            {
                DisableTariffNotify = true;
            }
            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList, ItemAvailableState.Normal);

            if (CurrentUser.IsVisitor())
            {
                _customNavItems.RemoveAll(item => item.ID == WebItemManager.MailProductID); // remove mail for guest
            }

            if (DisableProductNavigation)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList, ItemAvailableState.Normal); //.Where(pr => !CurrentProductID.Equals(pr.ID));
                DisplayModuleList           = productsList.Any() && !CoreContext.Configuration.YourDocs;
                _productRepeater.DataSource = productsList;

                _productRepeater.DataBind();

                var addons = _customNavItems.Where(pr => ((pr.ID == WebItemManager.CalendarProductID || pr.ID == WebItemManager.TalkProductID || pr.ID == WebItemManager.MailProductID)));
                //if (GetCurrentWebItem != null)
                //    _addons = _addons.Where(pr => pr.ID != GetCurrentWebItem.ID);
                _addonRepeater.DataSource = addons.ToList();
                _addonRepeater.DataBind();

                MoreProductsRepeater.DataBind();
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render == null)
                {
                    continue;
                }

                try
                {
                    var control = render.LoadCustomNavigationControl(Page);
                    if (control != null)
                    {
                        _customNavControls.Controls.Add(control);
                    }
                }
                catch (Exception ex)
                {
                    log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Page is Auth || this.Page is _Default)
            {
                _currentProductID = Guid.Empty;
            }
            else
            {
                _currentProductID = CommonLinkUtility.GetProductID();
            }

            CurrentProduct = ProductManager.Instance[_currentProductID];

            InitScripts();

            if (!DisableUserInfo.HasValue)
            {
                _guestInfoHolder.Visible = !(Page is Auth) && CoreContext.TenantManager.GetCurrentTenant().Public&& !SecurityContext.IsAuthenticated;
                _userInfoHolder.Visible  = SecurityContext.IsAuthenticated && !(Page is Wizard);
            }
            else
            {
                _guestInfoHolder.Visible = !DisableUserInfo.Value && !(Page is Auth) && CoreContext.TenantManager.GetCurrentTenant().Public&& !SecurityContext.IsAuthenticated;
                _userInfoHolder.Visible  = !DisableUserInfo.Value && SecurityContext.IsAuthenticated && !(Page is Wizard);
            }

            if (SecurityContext.IsAuthenticated)
            {
                CurrentUser = CoreContext.UserManager.GetUsers(SecurityContext.CurrentAccount.ID);
            }

            if (this.Page is Auth || this.Page is _Default)
            {
                DisableProductNavigation = true;
            }

            var tariff      = CoreContext.TenantManager.GetTariff(CoreContext.TenantManager.GetCurrentTenant().TenantId);
            var tenantState = tariff.State;

            if ((this.Page is Auth) || ((tenantState.Equals(TariffState.Trial) == false) && (tenantState.Equals(TariffState.NotPaid) == false)))
            {
                DisableTrialPeriod = true;
            }

            if (((tenantState.Equals(TariffState.Trial)) && (!IsAdministrator)))
            {
                DisableTrialPeriod = true;
            }
            _customNavItems = WebItemManager.Instance.GetItems(WebZoneType.CustomProductList);

            if (DisableProductNavigation)
            {
                _productListHolder.Visible = false;
            }
            else
            {
                var productsList = WebItemManager.Instance.GetItems(WebZoneType.TopNavigationProductList);
                DisplayModuleList           = productsList.Any();
                _productRepeater.DataSource = productsList;
                _productRepeater.DataBind();

                var _addons = _customNavItems.Where(pr => ((pr.ID == new Guid("{32D24CB5-7ECE-4606-9C94-19216BA42086}") || pr.ID == new Guid("{2A923037-8B2D-487b-9A22-5AC0918ACF3F}"))));
                //if (GetCurrentWebItem != null)
                //    _addons = _addons.Where(pr => pr.ID != GetCurrentWebItem.ID);
                _addonRepeater.DataSource = _addons.ToList();
                _addonRepeater.DataBind();


                MoreProductsRepeater.DataBind();
            }

            DisableSearch         = (DisableSearch || _handlerItems == null || _handlerItems.Count == 0);
            _searchHolder.Visible = !DisableSearch;

            if (NavigationItems.Count == 0)
            {
                _navItemRepeater.Visible = false;
            }
            else
            {
                _navItemRepeater.DataSource = NavigationItems;
                _navItemRepeater.DataBind();
            }

            if (String.IsNullOrEmpty(_title) && DisableSearch)
            {
                _contentSectionHolder.Visible = false;
            }

            foreach (var item in _customNavItems)
            {
                var render = WebItemManager.Instance[item.ID] as IRenderCustomNavigation;
                if (render != null)
                {
                    try
                    {
                        var control = render.LoadCustomNavigationControl(this.Page);
                        if (control != null)
                        {
                            _customNavControls.Controls.Add(control);
                        }
                    }
                    catch (Exception ex)
                    {
                        log4net.LogManager.GetLogger("ASC.Web.Studio").Error(ex);
                    }
                }
            }

            myToolsItemRepeater.DataSource = WebItemManager.Instance.GetItems(WebZoneType.MyTools).OfType <IRenderMyTools>();
            myToolsItemRepeater.DataBind();
        }