Esempio n. 1
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();

            if (portalSettings != null && !String.IsNullOrEmpty(portalSettings.LogoFile))
            {
                var fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile);
                headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo);
            }
            else
            {
                headerImage.Visible = false;
            }

            string strLocalizedMessage = Null.NullString;
            var    objSecurity         = new PortalSecurity();
            string status = objSecurity.InputFilter(Request.QueryString["status"],
                                                    PortalSecurity.FilterFlag.NoScripting |
                                                    PortalSecurity.FilterFlag.NoMarkup);

            if (!string.IsNullOrEmpty(status))
            {
                ManageError(status);
            }
            else
            {
                //get the last server error
                Exception exc = Server.GetLastError();
                try
                {
                    if (Request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx"))
                    {
                        ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString())));
                    }
                    else
                    {
                        var lex = new PageLoadException(exc.Message, exc);
                        //process this error using the Exception Management Application Block
                        Exceptions.LogException(lex);
                        //add to a placeholder and place on page
                        strLocalizedMessage = Localization.Localization.GetString("Error.Text",
                                                                                  Localization.Localization.
                                                                                  GlobalResourceFile);
                        ErrorPlaceHolder.Controls.Add(
                            new ErrorContainer(portalSettings, strLocalizedMessage, lex).Container);
                    }
                } catch
                {
                    //No exception was found...you shouldn't end up here
                    //unless you go to this aspx page URL directly
                    strLocalizedMessage = Localization.Localization.GetString("UnhandledError.Text",
                                                                              Localization.Localization.
                                                                              GlobalResourceFile);
                    ErrorPlaceHolder.Controls.Add(new LiteralControl(strLocalizedMessage));
                }
            }
            strLocalizedMessage = Localization.Localization.GetString("Return.Text",
                                                                      Localization.Localization.GlobalResourceFile);

            hypReturn.Text = "<img src=\"" + Globals.ApplicationPath + "/images/lt.gif\" border=\"0\" /> " +
                             strLocalizedMessage;
        }
Esempio n. 2
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            var portalSettings = PortalController.Instance.GetCurrentPortalSettings();

            if (portalSettings != null && !string.IsNullOrEmpty(portalSettings.LogoFile))
            {
                IFileInfo fileInfo = FileManager.Instance.GetFile(portalSettings.PortalId, portalSettings.LogoFile);
                if (fileInfo != null)
                {
                    this.headerImage.ImageUrl = FileManager.Instance.GetUrl(fileInfo);
                }
            }

            this.headerImage.Visible = !string.IsNullOrEmpty(this.headerImage.ImageUrl);

            string localizedMessage;
            var    security = PortalSecurity.Instance;
            var    status   = security.InputFilter(
                this.Request.QueryString["status"],
                PortalSecurity.FilterFlag.NoScripting |
                PortalSecurity.FilterFlag.NoMarkup);

            if (!string.IsNullOrEmpty(status))
            {
                this.ManageError(status);
            }
            else
            {
                // get the last server error
                var exc = this.Server.GetLastError();
                try
                {
                    if (this.Request.Url.LocalPath.ToLowerInvariant().EndsWith("installwizard.aspx"))
                    {
                        this.ErrorPlaceHolder.Controls.Add(new LiteralControl(HttpUtility.HtmlEncode(exc.ToString())));
                    }
                    else
                    {
                        var lex = new PageLoadException(exc.Message, exc);
                        Exceptions.LogException(lex);
                        localizedMessage = Localization.GetString("Error.Text", Localization.GlobalResourceFile);
                        this.ErrorPlaceHolder.Controls.Add(new ErrorContainer(portalSettings, localizedMessage, lex).Container);
                    }
                }
                catch
                {
                    // No exception was found...you shouldn't end up here
                    // unless you go to this aspx page URL directly
                    localizedMessage = Localization.GetString("UnhandledError.Text", Localization.GlobalResourceFile);
                    this.ErrorPlaceHolder.Controls.Add(new LiteralControl(localizedMessage));
                }

                this.Response.StatusCode = 500;
            }

            localizedMessage = Localization.GetString("Return.Text", Localization.GlobalResourceFile);

            this.hypReturn.Text = localizedMessage;
        }