/// <summary>
 /// Disable current MembershipUser
 /// </summary>
 /// <param name="args">Action arguments</param>
 public void Execute(ActionArgs args)
 {
     MembershipUser user = Membership.GetUser();
     if (user != null) {
         user.IsApproved = false;
         Membership.UpdateUser(user);
     }
 }
        /// <summary>
        /// Execute redirect action 
        /// </summary>
        /// <param name="args"></param>
        public void Execute(ActionArgs args)
        {
            HttpContext context = HttpContext.Current;
            if (context == null) {
                throw new InvalidOperationException();
            }

            context.Server.TransferRequest(_url);
        }
        /// <summary>
        /// Execute redirect action 
        /// </summary>
        /// <param name="args"></param>
        /// <remarks>Will terminate the current request</remarks>
        public void Execute(ActionArgs args)
        {
            HttpResponse response = (HttpContext.Current != null ? HttpContext.Current.Response : null);
            if (response == null) {
                throw new InvalidOperationException();
            }


            response.Redirect(_url, true);
        }
        /// <summary>
        /// Execute action
        /// </summary>
        /// <param name="args">Arguments</param>
        public void Execute(ActionArgs args)
        {
            if (args == null) {
                return;
            }

            IntrusionException intrusionException = args.FaultException as IntrusionException;
            if (intrusionException != null) {
                Esapi.Logger.Fatal(LogEventTypes.SECURITY, intrusionException.LogMessage);
            }
        }
        /// <summary>
        /// Block current request
        /// </summary>
        /// <param name="args"></param>
        /// <remarks>Will end the current request</remarks>
        public void Execute(ActionArgs args)
        {
            HttpResponse response = (HttpContext.Current != null ? HttpContext.Current.Response : null);

            if (null == response) {
                throw new InvalidOperationException();
            }

            response.ClearHeaders();
            response.ClearContent();

            response.StatusCode = _statusCode;
            response.End();
        }
        /// <summary>
        /// Handle rule execution fault
        /// </summary>
        /// <param name="handler">
        /// A <see cref="EventHandler<RuntimeEventArgs>"/>
        /// </param>
        /// <param name="sender">
        /// A <see cref="System.Object"/>
        /// </param>
        /// <param name="args">
        /// A <see cref="RuntimeEventArgs"/>
        /// </param>
        /// <param name="exp">
        /// A <see cref="Exception"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        protected override bool ForwardEventFault(EventHandler<RuntimeEventArgs> handler, object sender, RuntimeEventArgs args, Exception exp)
        {
            // Init action args
            ActionArgs actionArgs = new ActionArgs() {
                FaultingRule = _rule,
                FaultException = exp,
                RuntimeArgs = args
            };

            try {
                // Run each action
                foreach (IAction action in _faultActions) {
                    action.Execute(actionArgs);
                }
            }
            catch (Exception) {
                // Nothing to do anymore, throw 
                throw;
            }

            return true;
        }
        /// <summary>
        /// Handle rule execution fault
        /// </summary>
        /// <param name="handler">
        /// A <see cref="EventHandler<RuntimeEventArgs>"/>
        /// </param>
        /// <param name="sender">
        /// A <see cref="System.Object"/>
        /// </param>
        /// <param name="args">
        /// A <see cref="RuntimeEventArgs"/>
        /// </param>
        /// <param name="exp">
        /// A <see cref="Exception"/>
        /// </param>
        /// <returns>
        /// A <see cref="System.Boolean"/>
        /// </returns>
        protected override bool ForwardEventFault(EventHandler <RuntimeEventArgs> handler, object sender, RuntimeEventArgs args, Exception exp)
        {
            // Init action args
            ActionArgs actionArgs = new ActionArgs()
            {
                FaultingRule   = _rule,
                FaultException = exp,
                RuntimeArgs    = args
            };

            try {
                // Run each action
                foreach (IAction action in _faultActions)
                {
                    action.Execute(actionArgs);
                }
            }
            catch (Exception) {
                // Nothing to do anymore, throw
                throw;
            }

            return(true);
        }
 public void Execute(ActionArgs args)
 {
     Impl.Execute(args);
 }
 /// <summary>
 /// Logout user using FormsAuthentication
 /// </summary>
 /// <param name="args"></param>
 public void Execute(ActionArgs args)
 {
     FormsAuthentication.SignOut();
 }