protected void Page_Load(object sender, EventArgs e)
        {
            if (RequiresLegacyIE)
            {
                var meta = new HtmlMeta {
                    Name = "IE7Compatible", HttpEquiv = "X-UA-Compatible", Content = "IE=7"
                };
                Page.Header.Controls.Add(meta);
            }
            else
            {
                // Still need to force IE to use IE10 mode because Compatibility View may be turned on for intranet websites.
                // This will make IE to run in compatibility mode. Some pages designed for IE10+ will not be rendered properly in that case
                var meta = new HtmlMeta {
                    Name = "IE7Compatible", HttpEquiv = "X-UA-Compatible", Content = "IE=10"
                };
                Page.Header.Controls.Add(meta);
            }

            if (IsPostBack)
            {
                return;
            }

            LogoutLink.HRef = "~/Pages/Login/Logout.aspx" + "?ReturnUrl=" + this.Request.Url.AbsoluteUri;

            if (SessionManager.Current != null && SessionManager.Current.User != null && SessionManager.Current.User.WarningMessages.Count > 0)
            {
                if (!SessionManager.Current.User.WarningsDisplayed)
                {
                    SessionManager.Current.User.WarningsDisplayed = true;
                    SessionManager.InitializeSession(SessionManager.Current);
                    LoginWarningsDialog.Show();
                }
            }

            if (ConfigurationManager.AppSettings.GetValues("CachePages")[0].Equals("false"))
            {
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
                Response.Expires = -1;
            }

            AddIE6PngBugFixCSS();
            if (SessionManager.Current != null && SessionManager.Current.User != null)
            {
                var id = SessionManager.Current.User.Identity as CustomIdentity;

                if (DisplayUserInformationPanel)
                {
                    Username.Text = id != null ? id.DisplayName : "unknown";

                    try
                    {
                        var alertControl = (AlertIndicator)LoadControl("~/Controls/AlertIndicator.ascx");
                        AlertIndicatorPlaceHolder.Controls.Add(alertControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Alerts, control won't be displayed
                        //hide table cell that contains the control.
                        AlertIndicatorCell.Visible = false;
                    }
                    try
                    {
                        var warningControl = (LoginWarningIndicator)LoadControl("~/Controls/LoginWarningIndicator.ascx");
                        LoginIndicatorPlaceHolder.Controls.Add(warningControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Warning Indicator, control won't be displayed
                        //hide table cell that contains the control.
                        LoginWarningCell.Visible = false;
                    }
                }
                else
                {
                    UserInformationCell.Width = Unit.Percentage(0);
                    MenuCell.Width            = Unit.Percentage(100);
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            if (SessionManager.Current.User.WarningMessages.Count > 0)
            {
                if (!SessionManager.Current.User.WarningsDisplayed)
                {
                    SessionManager.Current.User.WarningsDisplayed = true;
                    SessionManager.InitializeSession(SessionManager.Current);
                    LoginWarningsDialog.Show();
                }
            }

            if (ConfigurationManager.AppSettings.GetValues("CachePages")[0].Equals("false"))
            {
                Response.CacheControl = "no-cache";
                Response.AddHeader("Pragma", "no-cache");
                Response.Expires = -1;
            }

            AddIE6PngBugFixCSS();
            if (SessionManager.Current != null)
            {
                var id = SessionManager.Current.User.Identity as CustomIdentity;

                if (DisplayUserInformationPanel)
                {
                    if (id != null)
                    {
                        Username.Text = id.DisplayName;
                    }
                    else
                    {
                        Username.Text = "unknown";
                    }

                    try
                    {
                        var alertControl = (AlertIndicator)LoadControl("~/Controls/AlertIndicator.ascx");
                        AlertIndicatorPlaceHolder.Controls.Add(alertControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Alerts, control won't be displayed
                        //hide table cell that contains the control.
                        AlertIndicatorCell.Visible = false;
                    }
                    try
                    {
                        var warningControl = (LoginWarningIndicator)LoadControl("~/Controls/LoginWarningIndicator.ascx");
                        LoginIndicatorPlaceHolder.Controls.Add(warningControl);
                    }
                    catch (Exception)
                    {
                        //No permissions for Warning Indicator, control won't be displayed
                        //hide table cell that contains the control.
                        LoginWarningCell.Visible = false;
                    }
                }
                else
                {
                    UserInformationCell.Width = Unit.Percentage(0);
                    MenuCell.Width            = Unit.Percentage(100);
                }
            }
        }