Inheritance: System.EventArgs
		public void OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			if (context.User.Identity.IsAuthenticated)
			{
				string name = context.User.Identity.Name.Trim();

				bool allow = !_denyAll && (_allowedUsers == null && _allowedRoles == null);

				if (allow && _deniedRoles != null)
					foreach (string role in _deniedRoles)
						if (context.User.IsInRole(role))
						{
							allow = false;
							break;
						}

				if (allow && _deniedUsers != null)
					foreach (string user in _deniedUsers)
						if (user.Equals(name, StringComparison.InvariantCultureIgnoreCase))
						{
							allow = false;
							break;
						}

				if (!allow && _allowedRoles != null)
					foreach (string role in _allowedRoles)
						if (context.User.IsInRole(role))
						{
							allow = true;
							break;
						}

				if (!allow && _allowedUsers != null)
					foreach (string user in _allowedUsers)
						if (user.Equals(name, StringComparison.InvariantCultureIgnoreCase))
						{
							allow = true;
							break;
						}

				if (!allow)
				{
					FormsAuthentication.RedirectToLoginPage();
					context.Response.End();
				}
			}
			else
			{
				FormsAuthentication.RedirectToLoginPage();
				context.Response.End();
			}
		}
		public void OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			Uri uri = context.Request.Url;
			if (!context.Request.IsSecureConnection || (Port > 0 && uri.Port != Port) || (Host != null && !Host.Equals(uri.Host, StringComparison.CurrentCultureIgnoreCase)))
			{
				if (context.Request.RequestType != "GET")
					throw new HttpException(403, "The request can only be processed via the HTTPS protocol.");

				int port = Port > 0 ? Port : 443;
				string host = Host ?? uri.Host;
				throw new Redirect("https://" + host + (port != 443 ? ":" + port.ToString() : null) + uri.PathAndQuery, true);
			}
		}
		public void OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			Uri uri = context.Request.Url;
			bool hostAccepted = false;
			foreach (string host in Hosts)
				if (host != null && host.Equals(uri.Host, StringComparison.CurrentCultureIgnoreCase))
				{
					hostAccepted = true;
					break;
				}
			if ((Port > 0 && uri.Port != Port) || !hostAccepted)
			{
				if (context.Request.RequestType != "GET")
					return; // Skip for none GET requests which can't be redirected

				int port = Port > 0 ? Port : uri.Port;
				string host = hostAccepted ? uri.Host : Hosts[0];
				throw new Redirect((context.Request.IsSecureConnection ? "https://" : "http://") + host + (port != (context.Request.IsSecureConnection ? 443 : 80) ? ":" + Port.ToString() : null) + uri.PathAndQuery, true);
			}
		}
		protected void OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			if (ControllerExtensions != null)
				foreach(IExtension ext in ControllerExtensions)
					ext.OnBeforeAction(context, args);

			if (ActionExtensions != null)
				foreach(IExtension ext in ActionExtensions)
					ext.OnBeforeAction(context, args);

			if (Properties != null)
				foreach (PropertyHandler prop in Properties)
				{
					object v;
					if (prop.Binding.TryBinding(context, out v))
						prop.Property.SetValue(args.Controller, v, null);
				}

			Binding.OnBeforeAction(context, args);
		}
		protected virtual void OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			// Raise OnBeforeActionDelegate
		}
		void IActionBinding.OnBeforeAction(IHttpContext context, BeforeActionEventArgs args)
		{
			OnBeforeAction(context, args);
		}