/// <summary>
 /// Displays an error page.
 /// </summary>
 /// <param name="context">The current HTTP context.</param>
 /// <param name="errorMessage">The error message.</param>
 /// <param name="overrideConfigSetting">if set to <c>true</c> [override config setting].</param>
 public void HandleError(HttpContext context, string errorMessage, bool overrideConfigSetting)
 {
     if (!string.IsNullOrEmpty(ErrorBehaviour) && ErrorBehaviour.Equals(dk.nita.saml20.config.ErrorBehaviour.THROWEXCEPTION.ToString()))
     {
         throw new Saml20Exception(errorMessage);
     }
     else
     {
         ErrorPage page = new ErrorPage();
         page.OverrideConfig = overrideConfigSetting;
         page.ErrorText = errorMessage;
         page.ProcessRequest(context);
         context.Response.End();
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Displays an error page.
        /// </summary>
        /// <param name="context">The current HTTP context.</param>
        /// <param name="errorMessage">The error message.</param>
        /// <param name="overrideConfigSetting">if set to <c>true</c> [override config setting].</param>
        public void HandleError(HttpContext context, string errorMessage, bool overrideConfigSetting)
        {
            Boolean showError = SAML20FederationConfig.GetConfig().ShowError;
            String DEFAULT_MESSAGE = "Unable to validate SAML message!";

            if (!string.IsNullOrEmpty(ErrorBehaviour) && ErrorBehaviour.Equals(dk.nita.saml20.config.ErrorBehaviour.THROWEXCEPTION.ToString()))
            {
                if (showError)
                    throw new Saml20Exception(errorMessage);
                else
                    throw new Saml20Exception(DEFAULT_MESSAGE);
            }
            else
            {
                ErrorPage page = new ErrorPage();
                page.OverrideConfig = overrideConfigSetting;
                page.ErrorText = (showError) ? errorMessage : DEFAULT_MESSAGE;
                page.ProcessRequest(context);
                context.Response.End();
            }
        }